3

I'm using the below DELETE query.

DELETE FROM tableAA WHERE id IN (SELECT id FROM tableAA WHERE coreID IN (SELECT fill_ID FROM tableBBB) and columnData= 'data');

but I am getting this "update you can't specify target table for update in from clause" error.

  • Take a look at this question? https://stackoverflow.com/questions/7298504/mysql-delete-with-nested-select-query – Erwin Jul 01 '22 at 22:51

2 Answers2

1

Sorry, i can not check my example right now:

DELETE FROM tableAA LEFT JOIN tableAA.id = fill_ID.tableBBB WHERE fill_ID NOT IS NULL and columnData = data;
Maxim Danilov
  • 2,472
  • 1
  • 3
  • 8
1

Try with this one:

DELETE FROM tableAA 
WHERE coreID IN (SELECT fill_ID FROM tableBBB)
  AND columnData = 'data';
lemon
  • 14,875
  • 6
  • 18
  • 38