mysql中union,union all 与order by 的常见用法

注意点:

多个复合查询使用一个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

发布了39 篇原创文章 · 获赞 13 · 访问量 2311

猜你喜欢

转载自blog.csdn.net/weixin_45612794/article/details/103610187