I want to delete records in the parent table as well as in the child table using only one query. I m has the name of the child table CHILD1_TABLEin the parent table PARENT_TABLEin the name field TABLENAME. The parent table contains more child tables. I want to delete only one record from one of the child table, as well as the parent table. Common field IDin child and parent tables. I write my request as follows:
DELETE PARENT.*,CHILD.*
FROM PARENT_TABLE PARENT
INNER JOIN (SELECT TABLENAME FROM PARENT_TABLE WHERE ID='CHILD1-001') CHILD
ON PARENT.ID=CHILD.ID
WHERE PARENT.ID='CHILD1-001'
But that does not work. Can anybody help me?
source
share