I'm trying to convert a select statement that is working correctly into a delete statement and I'm not having any luck. I'm trying to delete data from a parent and child table. The child table doesn't always have any child records but if it does then I want the data deleted in both tables if where clause is true. If there are no child records then I still want the parent table records to be deleted.
Here is the select statement that works like I want it to.
SELECT MY_PARENT.ID, MY_PARENT.PRINT_DATE, MY_CHILD_DTL.ID, MY_CHILD_DTL.MY_PARENT_ID
FROM MY_PARENT LEFT JOIN MY_CHILD_DTL ON MY_PARENT.ID = MY_CHILD_DTL.MY_PARENT_ID
WHERE MY_PARENT.PRINT_DATE IS NULL OR MY_PARENT.PRINT_DATE < (SYSDATE - 30)
I need to do the exact same thing with a DELETE COMMAND