code sender country
(12) Jane France
(12) Jane Spain
(15) Andy Germany
(15) Mary Italy
(16) Tom Spain[/code]I have a table named “sending” like the above and another table named reading like the below.
(read_day) reader country
(11) Andy Germany
(12) Jane Italy
(14) Andy France
(16) Tom Germany
When I like to find matching country in the table “reading”, I can use the code below.
SELECT reading.country as country
FROM reading
LEFT JOIN sending ON reading.country=sending.country
WHERE reading.country is NOT null
GROUP BY country
The code above produces the result below.
France
Germany
Italy
So far so good.
Now I like to find countries which are not in the table “reading”.
I made the trial code below for it.
SELECT reading.country as country
FROM reading
LEFT JOIN sending ON reading.country=sending.country
WHERE reading.country is null
GROUP BY country
My target result is the following, but the code above produces nothing.
Spain
Why does the trial code above produce nothing?
How can I get my target result above?