读书人

一个简单有关问题

发布时间: 2012-01-11 22:28:46 作者: rapoo

一个简单问题
select * from t1 where not exists(select 1 from t2 where 字段 <> t1.字段)
我想问一下这个语句是找到相同的记录还是不相同的啊

[解决办法]
通常情况结果为空,除非t2只有1条记录或者t2中【字段】的值只有1中
[解决办法]
--找不相同的记录
select * from t1 where not exists(select 1 from t2 where 字段=t1.字段)

读书人网 >SQL Server

热点推荐