union
会删除重复数据
union all
不会删除重复数据
select * from
(
select *,'a' as kind from tablea where name is not null
union all
select *, 'b' as kind from tableb where name = 'b-data'
) a
union
会删除重复数据
union all
不会删除重复数据
select * from
(
select *,'a' as kind from tablea where name is not null
union all
select *, 'b' as kind from tableb where name = 'b-data'
) a