I have a database that looks like this:
upID | bsID | pID | upUren | upDatum
-----+------+-----+--------+----------
1 | 4 | 2 | 12 | 2011-01-26 00:00:00
2 4 2 | 12 | 2011-01-26 00:00:00
3 4 2 | 12 | 2011-01-27 00:00:00
4 4 2 | 12 | 2011-01-28 00:00:00
I want to delete every row where pID
is equal AND bsID
is equal AND upDatum
is equal. So far i've got this:
DELETE FROM twh_uren_prognose WHERE EXISTS (SELECT b.* FROM twh_uren_prognose b WHERE twh_uren_prognose.upDatum = b.upDatum and twh_uren_prognose.upID <> b.upID
But this gives me this error:
An exception occurred while executing
DELETE FROM twh_uren_prognose
WHERE EXISTS
(
SELECT b.* FROM twh_uren_prognose b
WHERE twh_uren_prognose.upDatum = b.upDatum
and twh_uren_prognose.upID <> b.upID
)
SQLSTATE[HY000]: General error: 1093 You can't specify target table 'twh_uren_prognose' for update in FROM clause`.