Forum Discussion
cbjroms
Nov 15, 2023Copper Contributor
Delete Records Fails - Is It The Join?
This sql statement works (as intended) as a SELECT statement but fails as a DELETE.
I have tried to find an explantion of this on the Internet but cant find one that makes sense to me. Grateful for some help.
1 Reply
- LainRobertsonSilver Contributor
Hi, Chris.
You're close.
Take a look at the second and third examples from the following article, as you just need to alias your first table and then include the alias prior to the FROM (if you choose the third example's form, that is).
That said, based on your WHERE criteria, there's no need for a LEFT OUTER JOIN, since no rows from TASKS will ever be deleted unless a matching row is founds in TARGETS. You may as well just stick with an INNER JOIN.
Cheers,
Lain