我有一个sql语句 大概是这样的:delete from tab1 s where s.c=2 and (s.a,s.b) in (select t.a,m.b from tab1 t ,tab2 m where ...)
但是mysql一直报 You can't specify target table 'tab1' for update in FROM clause ,oracle是可以执行这个语句的,mysql就不行,怎么样改造这个语句呢?谁有好的办法?
但是mysql一直报 You can't specify target table 'tab1' for update in FROM clause ,oracle是可以执行这个语句的,mysql就不行,怎么样改造这个语句呢?谁有好的办法?
on s.b=m.b
inner join tab1 t on s.a=t.a
delete s from tab1 s inner join tab2 t
on s.b=m.b
inner join tab1 t on s.a=t.a
where s.c=2
DELETE s FROM tab1 s,tab2 t,tab1 m
WHERE s.b=m.b and s.a=t.a and s.c=2or
delete s from tab1 s inner join tab2 m
on s.b=m.b
inner join tab1 t on s.a=t.a
where s.c=2
where s.c=2 搞定了,谢谢WWWWA兄了。