I have a table with two columns A and B, they contain values of same domain, let's say I want to find the values that only appears in A but not in B, i.e
A has 1,2,3 B has 2,3
so my answer will be A - B = {1}
so the SQL query I wrote is
SELECT DISTINCT(A)
FROM DB
WHERE A NOT IN (SELECT DISTINCT(B)
FROM DB);
It doesn't work and taking forever to response (8000 records approx), does anyone have a solution similar to the above? Thanks.
I found some thread e.g MySQL: difference of two result sets but doesn't really do what I want to do thou.