A subquery can return a scalar (a single value), a single row, a single column, or a table (one or more rows of one or more columns). These are called scalar, column, row, and table subqueries. Subqueries that return a particular kind of result often can be used only in certain contexts, as described in the following sections.
There are few restrictions on the type of statements in which subqueries can be used. A subquery can contain any of the keywords or clauses that an ordinary SELECT can contain: DISTINCT, GROUP BY, ORDER BY, LIMIT, joins, index hints, UNION constructs, comments, functions, and so on.
One restriction is that a subquery’s outer statement must be one of: SELECT, INSERT, UPDATE, DELETE, SET, or DO. Another restriction is that currently you cannot modify a table and select from the same table in a subquery. This applies to statements such as DELETE, INSERT, REPLACE, UPDATE, and (because subqueries can be used in the SET clause) LOAD DATA INFILE.
A more comprehensive discussion of restrictions on subquery use, including performance issues for certain forms of subquery syntax, is given in Section F.3, ?Restrictions on Subqueries?.
UPDATE TMP_IRIS AS T1, TMP_IRIS AS T2 SET T1.GRUPO = 1 WHERE T2.ID = 2;
rafaelglauber
velho, de boa, dê uma estudada em SQL, esse comanda não tem muito sentido mesmo tendo executado…não tem necessidade de ter a TMP_IRIS com mais de uma declaração, bastava: UPDATE TMP_IRIS AS T1 SET T1.GRUPO = 1 WHERE T1.ID = 2 você pode gerar problemas diversos se não dominar SQL, ainda mais em 1 UPDATE.