sKunKbad Posted December 28, 2015 Share Posted December 28, 2015 I've got a working delete query that removes rows where there is no match in another table. It works fine, but the example I found online made me wonder about something. DELETE a FROM table_a a LEFT JOIN table_c c ON c.id = a.id WHERE c.id IS NULL My question is about the first line, "DELETE a". Does that "a" make the query functionally different than leaving it out, like this: DELETE FROM table_a a LEFT JOIN table_c c ON c.id = a.id WHERE c.id IS NULL Are these two delete queries exactly the same for the intended use? I've just never seen somebody write a delete query like that (including that "a") before. Quote Link to comment Share on other sites More sharing options...
benanamen Posted December 28, 2015 Share Posted December 28, 2015 the a and the C just shortcuts to the table names Quote Link to comment Share on other sites More sharing options...
Solution Jacques1 Posted December 28, 2015 Solution Share Posted December 28, 2015 The second query is syntactically invalid. See the manual for how to write a multi-table DELETE query. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.