注意点:

多个复合查询使用一个orderby时,注意用AS后的属性名才行!

例如:

SELECT user_name AS userName,sco_re AS score FROM t1 WHERE user_name LIKE '王%'
UNION
SELECT user_name AS userName,sco_re AS score FROM t1 WHERE user_name LIKE '%m%' ORDER BY score ASC

具体使用见:https://www.cnblogs.com/pcheng/p/5939646.html

Logo

更多推荐