I'm trying to delete the session and exercises related to that session using:
$delete_session =
"DELETE FROM sessions, exercises
USING sessions
INNER JOIN exercises
ON sessions.session_id = exercises.session_id
WHERE sessions.session_id= '$delete_id'";
The above query works if there are exercises linked to the session but doesn't fire if the session has no exercises.
Can I use the above query and below one together?
"DELETE FROM sessions WHERE session_id= '$delete_id'";
How could I get it that the session will delete with or without exercises linked to it?
LEFT JOIN