Paul Noris Paul Noris - 3 years ago 53
MySQL Question

Select differentiating records from two tables

I have two tables with a field called

. I want to select only the dates of
that are diferent from

In this case, the result would be 4 and 5.

Table1 Table2 Result
Date Date Date
1 1 4
2 2 5
3 3

Gab Gab
Answer Source

If I understand correctly your question you want to select from Table1 the rows that are not in Table2 as well. Here is how you would do that:

SELECT Date FROM Table1 WHERE Date not in (SELECT Date FROM Table2)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download