I would like to know how many serial numbers appear in table 2 but not in table 1. When I run:
SELECT count(DISTINCT sn)
FROM table2
WHERE sn NOT IN (table1.sn)
I get 0.
I am certain there exist serial numbers in table2 not in table1, luckily when I run:
SELECT count(DISTINCT sn)
FROM table2
WHERE sn NOT IN (
SELECT DISTINCT table1.sn
FROM(
table1 INNER JOIN table2 ON(table1.sn=table2.sn)
)
)
I get a large number of sn's.
This is not logically possible! It means there are serial numbers in table 2 not in the join, but there are no serial numbers in table 2 not in table 1. I tried casting the results from the query & sub query to text and that didn't work.