查询从一个表中返回所有记录不在另外一个表中的结果集的方法

来源:互联网 发布:产品经理必备的软件 编辑:程序博客网 时间:2024/05/26 22:56

查询从一个表t1中返回所有t1不在表t2中的结果集

方法一:select* from t1 whrer t1.id not in (select id from t2)

方法二:select temptab.id,temptab.value from (select t1.*,t2.id as tempcolum from t1 left join t2 on t1.id=t2.id) as temptab where temptab.tempcolum is null

原创粉丝点击