I have two entities A and B that are related in a MxN relation through an intermediary table, thus making a total of three tables. My relation table R has non-nullable FK constraints on the other two tables.
I want to delete all entries from tables A and B and R where A obeys some constraint (I can supply the ids in A table for instance).
Is it possible to delete entries from the three tables without resorting to a stored procedure and without violating the non-null constraint?
I want something like:
delete from A a, B b, R r where a.id=r.fk_a and B.id=r.fk_B a