sql语句如何查询两个表中几个字段有不相同的数据集合?

2024-11-30 17:48:06
推荐回答(3个)
回答1:

select distinct ABCDEF
(

select * from 表1
union all
select * from 表2
)
as 表

回答2:

select * from table1 a where not exists (select 1 from table2 b where a.a <> b.a and a.b<>b.b and a.c <> b.c)

回答3:

ps/sql的语法和T-sql差不多,无外乎联接查询和嵌套子查询两种方式。
具体的写法我就不赘述了,网上的例子有很多,楼上自己去试试写写看。。