开发者

MySQL DELETE query issue with Select

开发者 https://www.devze.com 2023-03-10 01:04 出处:网络
The following query: DELETE FROM CO05IN.ININVPRC WHERE IPPART IN (SELECT IPPART FROM CO05IN.ININVPRC left join CO05IN.ININVMST on IPPART = IMP开发者_StackOverflow社区ART where IMPART is null);

The following query:

DELETE FROM CO05IN.ININVPRC WHERE IPPART IN (SELECT IPPART FROM CO05IN.ININVPRC left join CO05IN.ININVMST on IPPART = IMP开发者_StackOverflow社区ART where IMPART is null);

Creates this on the log: You can't specify target table 'ININVPRC' for update in FROM clause.

What is causing this?

Note using MySQL version 5.1


Try in this way.

DELETE FROM CO05IN.ININVPRC WHERE IPPART IN (select * from (SELECT IPPART FROM CO05IN.ININVPRC left join CO05IN.ININVMST on IPPART = IMPART where IMPART is null) as t);
0

精彩评论

暂无评论...
验证码 换一张
取 消