I have an issue with getting select sub-queries to work on an UPDATE
. I'm trying something like the following:
UPDATE foo
SET bar=bar-1
WHERE baz=
(
SELECT baz
FROM foo
WHERE fooID='1'
)
Where foo
is the table name with primary key fooID
. bar
and baz
are of type INT. When executing this I get the following error:
Error: A query failed. You can't specify target table 'foo' for update
in FROM clause