首页 > 其他 > 详细

培训系列17--union all 和disctinct 的用法

时间:2018-12-20 13:37:19      阅读:274      评论:0      收藏:0      [点我收藏+]

一。union all 的用法。使用union all 或者 union
select * from rental where rental_id <10
union all
select * from rental where rental_id >30 and rental_id <40

二。disctinc 的用法
select distinct * from (
select "abc","41",3.12
union all
select "def","41",3.13
union all
select "abc","41",3.12

) a;

Total MapReduce CPU Time Spent: 7 seconds 570 msec
OK
abc 41 3.12
def 41 3.13
Time taken: 36.445 seconds, Fetched: 2 row(s)

//注意:union all 句子总不能使用order by limit这些关键字

培训系列17--union all 和disctinct 的用法

原文:https://www.cnblogs.com/davidzhu/p/10148395.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!