I have a table called 'agenda' //translation: dairy
with the following rows:
idagenda // primary key
title
waar
organisatie
...
etc.
...
I also have a table for the date of an diary item/event called agendadatum
with the following rows:
id // primary key
idagenda // id from other table
van //from
tot // till
datum // date
When the field 'tot' is the date from Today it will delete the rows from the database, but the rows in the 'agenda' table remain untouched. They're not deleted, because I did not call them.
My delete query looks like this:
DELETE FROM agendadatum WHERE tot < NOW();
How can I also delete the rows from 'agenda' table, that have the same id then the foreign key in agendadatum?