一。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