I have 2 tables
presence table:
matricule date_effet
248 2017-01-30
248 2017-01-31
248 2017-02-01
248 2017-02-02
Activities table :
Matricule date
248 2017-01-31
248 2017-02-01
248 2017-02-02
what i want is to extract the dates that exist on the first one and don't exist in the second one in this case 2017-01-30 knowing that the user will select a range date for exemple in this case maybe date between 2017-01-28 and 2017-02-02
Try this:
SELECT date_effet FROM presence WHERE date_effet NOT IN(SELECT date FROM activities)
The inner SELECT statement will select all the dates from second table, and then the first select will select all the dates from first table which do not exist in the second table.
Hope it helps!
0 comments:
Post a Comment