求一简单SQL
表A
FF GG
5555 1233
5454 2345
1233 2222
2345
2222
我想查出 FF 里 GG里没有的数据.
------解决方案--------------------select * from a where ff not in (select gg from a)
------解决方案-------------------- create table 表A(FF varchar(100),GG varchar(100))
insert into 表A
select 5555, 1233 union all
select 5454, 2345 union all
select 1233, 2222 union all
select 2345,null union all
select 2222,null
select * from 表A
select * from 表A
where isnull(FF, ' ') not in (select isnull(GG, ' ') from 表A)
drop table 表A