有两张表,table1,table2,其中都有字段a,现在想查询table1.a不存在于table2.a中的信息
我写了两个语句
select table1.* from table1,table2 where table1.a not in table2.a
和select table1.* from table1,table2 where table1.a != table2.a
可是执行后查询的数据只有一条数据且重复n边,不知道何种原因造成,我应该怎么写?
谢谢!
我写了两个语句
select table1.* from table1,table2 where table1.a not in table2.a
和select table1.* from table1,table2 where table1.a != table2.a
可是执行后查询的数据只有一条数据且重复n边,不知道何种原因造成,我应该怎么写?
谢谢!
minus
select a from table2
select t1.* from table1 t1 where not exists(select t2.* from table2 t2 where t2.a= t1.a)