表A
f1 f2 f3
a1 b1 c1
a2 b2 c2
表B
f1 f2 f3 f4
a1 b1 c3 d1
a2 b1 c3 d1想取出一个记录集合并2个表的数据
以表A为基准,key 为 f1, f2结果为
f1 f2 f3
a1 b1 c1
a2 b2 c2
a2 b1 c3用union 是否可以实现
f1 f2 f3
a1 b1 c1
a2 b2 c2
表B
f1 f2 f3 f4
a1 b1 c3 d1
a2 b1 c3 d1想取出一个记录集合并2个表的数据
以表A为基准,key 为 f1, f2结果为
f1 f2 f3
a1 b1 c1
a2 b2 c2
a2 b1 c3用union 是否可以实现
union all
select f1,f2,f3 from 表B where (f1+f2) not in(select f1+f2 from 表A)
避免重复记录
select f1,f2,f3 from 表A
union all
select f1,f2,f3 from 表B
完全合彬
是什么