我想知道两个记录集是否不同。我为此使用了一个full outer join
。简单的例子:
select count(*) from
(
select 1 as c
union
select 2 as c
) t1
full outer join
(
select 1 as c
union
select 3 as c
) t2 on t1.c = t2.c
where t1.c is null or t2.c is null
SQLFiddle
如果记录集相等,则count()
返回0
。
有没有更好的方法来实现这一目标?