这是我的查询,该查询将首先显示 id 为 2 的用户,然后联合除用户 id 2 之外的其他用户。
(SELECT account.accountid,account.accountname FROM account,entity WHERE entity.id = account.accountid AND entity.deleted=0 AND account.accountid = 2)
UNION
(SELECT account.accountid,account.accountname FROM account,entity WHERE entity.crmid = account.accountid AND entity.deleted=0 AND account.accountid NOT IN(2) ORDER BY account.accountname )
查询很好地显示了结果,但 order by 不起作用。我必须在这里做什么?
请帮我。