I have two tables (t1 and t2), and t2 has zero or more rows that have a FK to t1's primary key. Note the zero rows which requires an OUTER JOIN.
I wish to delete the record in t1 corresponding to a given t1 primary key, and any related rows in t2.
I don't wish to use cascading deletes.
I've messed around with the following, but am not sure it is working.
Is this valid SQL?
Thanks
DELETE t1,t2
FROM t1
LEFT OUTER JOIN t2 ON t2.t1_id=t1.id
WHERE t1.id=123;