读书人

怎么判断A表的值在不在B表里面

发布时间: 2013-12-05 22:27:44 作者: rapoo

如何判断A表的值在不在B表里面
sql 语句查询出来的值 在a表里面不错在。

select * from b where b.code not in (select code from a)

问题: 如果3个字段(code,linecode,name)才能判断在a 表里面不存在该怎么写???
select * from b where (select code,linecode,name NOT IN (SELECT code,linecode,name FROM b))
[解决办法]
b=a(+) 选择a表都为空的项,或者慢慢and ** not in (selectment)and ** not in (selectment)
[解决办法]
select * from b where exits(select 1 from a where a.code= b.code and a.linecode = b.linecode and a.name= b.name)

读书人网 >oracle

热点推荐