Search code examples
mysqlmysql-error-1093

MySQL DELETE query issue with Select


The following query:

DELETE FROM CO05IN.ININVPRC WHERE IPPART IN (SELECT IPPART FROM CO05IN.ININVPRC left join CO05IN.ININVMST on IPPART = IMPART 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


Solution

  • 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);