0
votes

The following query is not working .Please tell me what is wrong here.Its giving Error report:SQL Error: ORA-00933: SQL command not properly ended 00933. 00000 - "SQL command not properly ended". I am trying to delete the data from two tables at a time.

delete t1,t2 from x t1 inner join y t2 on t1.id=t2.id where t1.id in 
(SELECT object_id FROM z WHERE name = 'YourName');
3
The error is from Oracle but tag says MySql ... - Nikola Markovinović
ya i have edited the tag - harqs

3 Answers

2
votes

Deleting data from two tables at a time in a single query??? Not possible.

0
votes

I guess you just can't delete data from two tables at the same time. You'll have to use 2 queries. Using Transactions may help with the consistency of your model.

0
votes

If t1 and t2 are inner joined, then your option is to make the reference ON DELETE CASCADE, so you only have to delete the parent row to automatically delete all children.

rgds.