A表左连B表,但又要A表中a1字段的值仅包含B表中 b1字段的记录,怎么写SQL语句啊?
如上,不用再在where 条件里加一个select语句,有什么好办法吗?
[解决办法]
select * from a,bwhere a.id=b.id(+) and instr(a1,b1)>0
[解决办法]
select a.* from a left join b on a.a1 = b.b1 where b1 is not null;
[解决办法]
select * from a,bwhere a1 not in (select b1 from b where a.id=b.id(+))
[解决办法]
select a.* from a left join b on a.a2 = b.b2 and a.a1<>b.b1