两个表的记录叠加到一个表中

select 字段名from 表1
union
select 字段名from 表2
where 条件

备注:union的位置有四种情况
union-取两个表中的数据(去除重复值)
union all-取得两个表中所有的值
intersect-取得两个表中不同的数据
minus-从表1中减去在表2中的数据

猜你喜欢

转载自kokorodo.iteye.com/blog/1402063
今日推荐