Thomas Wuercher
Grünschnabel
Hello!
Maybe somebody could give me a hint or workaround for a problem with the following statement:
What I' m obviously trying to do is first selecting a dataset with some initial-value and the lowest id and afterwards update this dataset.
The error-message is
'You can't specify target table 'lagerplaetze' for update in FROM clause'.
The MySQL-manual says it' s not allowed to specify the same table in the update- and subselect-statement, but what alternative have I got. The statement works with other databases like PostgreSQL pretty well.
In my application I therefore have to lock the table, select & update it, and afterwards unlock it again, but this seems pretty uncool to me, and I've got no ideas about possible side-effects on my app with competing access.
Thanks a lot in advance!
Best regards,
Thomas
Maybe somebody could give me a hint or workaround for a problem with the following statement:
Code:
update LAGERPLAETZE
set FERTIGUNGSAUFTRAG=123
where LAGERPLATZNUMMER in
(
select min(LAGERPLATZNUMMER) from LAGERPLAETZE where
FERTIGUNGSAUFTRAG=0
)
The error-message is
'You can't specify target table 'lagerplaetze' for update in FROM clause'.
The MySQL-manual says it' s not allowed to specify the same table in the update- and subselect-statement, but what alternative have I got. The statement works with other databases like PostgreSQL pretty well.
In my application I therefore have to lock the table, select & update it, and afterwards unlock it again, but this seems pretty uncool to me, and I've got no ideas about possible side-effects on my app with competing access.
Thanks a lot in advance!
Best regards,
Thomas