考虑not in和not exists
with temp1 as (
select
1 a,
2 b
),
temp2 as (
select
1 c,
4 d
)
select temp1.a from temp1 where temp1.a not in (select c from temp2)
其中,在主查询中,使用的所有字段都要用表别名.如temp1. 标注清楚,不然要报错
考虑not in和not exists
with temp1 as (
select
1 a,
2 b
),
temp2 as (
select
1 c,
4 d
)
select temp1.a from temp1 where temp1.a not in (select c from temp2)
其中,在主查询中,使用的所有字段都要用表别名.如temp1. 标注清楚,不然要报错