A表:
字段:aid
B表:
字段:bid
A,B两表没任何关系。
C表:
字段:aid,bid ---1条记录代表一个组合
需求:想找出所有a,b组合,是C表不存在的组合
select a.aid,b.id from A,B
where not in C 什么东西...?怎么写。。。头皮都想破了。。。。
A表:
字段:aid
B表:
字段:bid
A,B两表没任何关系。
C表:
字段:aid,bid ---1条记录代表一个组合
需求:想找出所有a,b组合,是C表不存在的组合
select a.aid,b.id from A,B
where not in C 什么东西...?怎么写。。。头皮都想破了。。。。
select DISTINCT t.* from (select a.id aid,b.id bid from atest a,btest b) t,ctest c
where (t.aid=c.aid and t.bid !=c.bid) or (t.aid !=c.aid and t.bid =c.bid)
or t.aid not in (select c1.aid from ctest c1 ) or t.bid not in (select c1.bid from ctest c1 )