把两个 select 语句的查询结果放到一起
两种方式:
UNION:合并时去除重复数据
UNION ALL:合并时不去除重复数据
书写格式:
UNION:select * from table1 union select * from table2;
select * from table1 union select * from table2;
UNION ALL:select * from table1 union all select * from table2;
select * from table1 union all select * from table2;
被合并的两个结果,列数,列类型必须相同