这句SQL语句该怎么写才对?
select uid from [user] where uid not in ((select uid from ainfo) 加 (select uid from binfo) 加 (select uid from cinfo) )
意思就是选出没有发布过信息的会员
从三个信息表的结果进行匹配
not in后面的就不知道该怎么描述了,就是选择出三个表里的会员并相加起来供前面的[user]表的uid进行匹配
这句SQL应该怎么写
------解决方案--------------------select uid from [user] where uid not in
(
(select uid from ainfo)
union
(select uid from binfo)
union
(select uid from cinfo)
)
------解决方案--------------------SQL code
select U.uid
from [user] U left join ainfo A ON U.uid=A.uid
left join binfo B ON U.uid=B.uid
left join cinfo C ON U.uid=C.uid
where A.uid is null AND
B.uid is null AND
C.uid is null