MySQL : delete from table that is used in the where clause
- by Eric
I am writing a small script to synchronize 2 MySQL tables ( t1 to be 'mirrored' to t2 )
In a step I would like to delete rows inside t2 that has been delete in t1 with the same id.
I tried this query :
delete from t2 where t2.id in
( select t2.id left join t1 on (t1.id=t2.id) where t1.id is null )
But Mysql forbid me to use t2 in the same…