序奏资讯
SQL大坑:union会合并后去重,union all不会有distinct的结果
col1, col2的结果会去重: select col1 , col2 from the_table1 union select col1 , col2 from the_table2 col1, col2的结果不会去重: select col1 , col2 from the_table1 union all select col1 , col2 fro
col1, col2的结果会去重:
select col1, col2
from the_table1
union
select col1, col2
from the_table2
col1, col2的结果不会去重:
select col1, col2
from the_table1
union all
select col1, col2
from the_table2
Spark的union,unionAll,unionByName都不会去重