Table1.
id | name
1 | Test
Table2.
id | post | table1_id
1 | mypst| 1
I need to remove a row from Table1 where id=1 and all rows from Table2 where table1_id=(1 is id from Table1).
I’m trying this:
DELETE FROM Table1
INNER JOIN Table2 ON Table2.table1_id = Table1.id AND Table1.id = 1
but I’m getting error:
Incorrect syntax near the keyword ‘INNER’.
What’s wrong?
You shouldn’t be doing deletes from multiple tables in one query
should be fine. Is there any specific reason you wish to do it using JOIN?