错误360:无法修改子查询中使用的表或视图 [英] Error 360: Cannot modify table or view used in subquery
问题描述
INFORMIX-SE 7.32:
INFORMIX-SE 7.32:
尝试执行以下语句时出现错误360:
I'm getting error 360 when I try to execute the following statement:
update transaction
set transaction.colx = (select tab1.cola from tab1)
where transaction.num = (select max(transaction.num) from transaction)
and transaction.colx IS NULL;
有什么想法吗?
推荐答案
您正在尝试UPDATE
表transaction
,并使用SELECT MAX
通过同一查询从同一表中读取.你不能那样做.
You're trying to UPDATE
the table transaction
and read from the same table using SELECT MAX
with the same query. You cannot do that.
通常,您不能修改表并在子查询中从同一表中选择.例如,此限制适用于以下形式的语句:
DELETE FROM t WHERE ... (SELECT ... FROM t ...);
UPDATE t ... WHERE col = (SELECT ... FROM t ...);
{INSERT|REPLACE} INTO t (SELECT ... FROM t ...);
In general, you cannot modify a table and select from the same table in a subquery. For example, this limitation applies to statements of the following forms:
DELETE FROM t WHERE ... (SELECT ... FROM t ...);
UPDATE t ... WHERE col = (SELECT ... FROM t ...);
{INSERT|REPLACE} INTO t (SELECT ... FROM t ...);
这篇关于错误360:无法修改子查询中使用的表或视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!