I have two tables say table X and table Y. I want to delete all data from table X with column value = x1 and also want to delete data from table Y with column value = x1.
How can i achieve this using a single Delete statement?
Thanks
Since you want to delete from multiple tables, you should specify the table you want to delete so you will not get syntax error.
DELETE x, y
FROM x INNER JOIN y ON x.Col = y.Col
WHERE x.Col = 'x1'
http://www.sqlfiddle.com/#!2/00ab7/1
delete x,y from x,y where x.colname='x1' and y.colname='x1'
Try this query.
Hope its helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With