This request works:
There are two successive FROMs. When I delete the first one, it doesn't work why?
DELETE FROM TableA FROM TableA dim LEFT OUTER JOIN ( SELECT DISTINCT ColA FROM TableB UNION ALL SELECT DISTINCT ColA FROM tableC ) A ON A.ColA= dim.ColA WHERE A.ColA IS NULL EDIT This one doesn't work which I was supposing was the correct one:
DELETE FROM TableA dim LEFT OUTER JOIN ( SELECT DISTINCT ColA FROM TableB UNION ALL SELECT DISTINCT ColA FROM tableC ) A ON A.ColA= dim.ColA WHERE A.ColA IS NULL Thanks
DELETEstatements varies across RDBMS (MySQL, Oracle, Microsoft SQL Server, et al.). "doesn't work" is close to useless in describing the actual behavior that is observed. Is it an error message? Are no rows deleted? Are too many rows deleted? What does "doesn't work" mean?ColAfirst in an equal conditionON A.ColA =and then in a NULL comparisonWHERE A.ColA IS NULL?dimthat don't have a matching row. (As to whether that works in a DELETE statement, that really depends on the RDBMS, what syntax is accepted and supported.)