我有两个问题,我想在我的SQL中回答。 我发现,联合国的想法能够帮助我这样做,但它并不完美,因为它没有保留所附的每一个问题的命令。 显然,我要这样做:
(SELECT name,city FROM people WHERE xxx ORDER BY yyy)
UNION
(SELECT name,city FROM people WHERE zzz ORDER BY www)
但是,当有“共识”时,Kall在欧安会的发言中获胜。
一种解决办法是,首先为每个分区和秩序增加一个集体领域:
(SELECT name,city, 0 as bogus FROM people WHERE xxx)
UNION
(SELECT name,city, 1 as bogus FROM people WHERE zzz)
ORDER by bogus ASC, wwwzzz
but this is deeply inefficient as the query has to go through all fields to sort on the bogus field. Do you know of any workaround?
谢谢。