mysql delete from table based on select from table -


What I thought would be simple.

The query I tried is as follows:

  Delete the discussion where in the ID (from different B1.id Buzz B1, choose Buzz B2 where b1.id! = B2 .id and b1.message = b2.message); Definitely selects the correct ID I want to delete, but I get an error  

Error 1093 (HI 1000): You specify the target table Can not discuss' discussion for updates in the FOr section ''

I have tried every different thing which I can think of, so now I am thinking that I can reach it on the wrong path I am here.

Can anyone help you?

You do not really need a subquery for this. This should work: BLE from Buzz 1, Buzz B2 WHERE b1.id & gt; B2.id and b1.message = b2.message;

This deletes the duplicate but leaves the original in the table.


Comments