错误360:无法修改子查询中使用的表或视图 [英] Error 360: Cannot modify table or view used in subquery

查看:157
本文介绍了错误360:无法修改子查询中使用的表或视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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;

有什么想法吗?

推荐答案

您正在尝试UPDATEtransaction,并使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆