我有两张桌子:
Number
和TEXT
Number
和TEXT
现在表1有Nr = 12345AB
和表2 Nr = 00012345AB
如何找到表1 中不在表2 中的所有列?
答案 0 :(得分:2)
尝试此选择:
select
*
from
table1 t1
left join table2 t2 on t1.number=t2.number
where
t2.number is null
答案 1 :(得分:1)
尝试 存在 :
select t1.*
from Table1 t1
where not exists (select 1
from Table2 t2
where t2.Number = t1.Number)
答案 2 :(得分:0)
我认为他正在寻找模糊匹配。在这种情况下=,LIKE,CONTAINS将不起作用。您需要将自己的内容类似于this solution。
答案 3 :(得分:0)
This is also a method but its too lengthy :-)
SELECT table1.*
FROM table2
WHERE (number NOT IN
(SELECT number
FROM table2)) AND (text NOT IN
(SELECT text
FROM table2))