subquery-restrictions.html
on
http://dev.mysql.com/doc/refman/5.1/en/subquery-restrictions.html
it relies
==============================================================
....
Exception: The preceding prohibition does not apply if you are using a subquery for the modified table in the FROM clause. Example:
UPDATE t ... WHERE col = (SELECT (SELECT ... FROM t...) AS _t ...);
Here the prohibition does not apply because the result from a subquery in the FROM clause is stored as a temporary table, so the relevant rows in t have already been selected by the time the update to t takes place.
===============================================================
Well, I have another example which used derived table....
UPDATE
t,
(SELECT MAX(id) AS max_id FROM t) AS derived_table
SET
test.id = view.max_id + 1
WHERE id=6;
regards,
Rafraf
Subject
Views
Written By
Posted
subquery-restrictions.html
3940
November 16, 2006 12:22AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.