I have two tables:
- Table 1 with columns
Number
andTEXT
- Table 2 with columns
Number
andTEXT
Now Table 1 has Nr = 12345AB
and Table 2 Nr = 00012345AB
How can I find all columns from Table 1 that are not in Table 2?
I have two tables:
Number
and TEXT
Number
and TEXT
Now Table 1 has Nr = 12345AB
and Table 2 Nr = 00012345AB
How can I find all columns from Table 1 that are not in Table 2?
Try this select:
select
*
from
table1 t1
left join table2 t2 on t1.number=t2.number
where
t2.number is null
Try exists:
select t1.*
from Table1 t1
where not exists (select 1
from Table2 t2
where t2.Number = t1.Number)
I think he is looking for a fuzzy match. In which case =, LIKE, CONTAINS will not work. You will need to roll your own similar to this solution.
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))