采用hash函数
with a as(
select 1 as c1
,null as c2
,3 as id
union all
select 1 as c1
,0 as c2
,3 as id
)
,
with b as (
select 1 as c1
,null as c2
union all
select 1 as c1
,0 as c2
)
select a.c1
,b.c1
a.c2
b.c2
from a
left join b
on a.id =b.id
where hash(a.c1+1 --加1的目的是因为hash(0)=hash(null),这两个意义不一样
,b.c2+1
)
<>
hash(b.c1+1
,b.c2+1)