select * from a where a_id not exists(select a.a_id from a,b where a.a_id=b.b_aid)
长度类型都是一样的,我想问一下,加上where b.b_aid=a_id 和不加有差别吗?
我不知道你的库是什么回事,可我用下边的语句一点错也没有。 create table a( id int) create table b( id int) select distinct id from a where a not in (select distinct id from b) 我的表可一点要求都没有
不妨试一试这句,首先说明,我没试,不一定能成。 select a_id from A where a_id in (select distinct b_aid as a_aid from B);
where a_id not exists(select a.a_id from a,b where a.a_id=b.b_aid)
create table a(
id int)
create table b(
id int)
select distinct id from a where a not in (select distinct id from b)
我的表可一点要求都没有
select a_id from A where a_id in (select distinct b_aid as a_aid from B);