更新错误列参数不存在

时间:2013-09-06 13:01:50

标签: sql teradata

尝试执行此查询我遇到此错误:

Update failed. 3810: Column/parameter 'edw_workarea.A.A' does not exist.

我正在使用Teradata数据库。

UPDATE A
FROM   EDW_WORKAREA.bs A,
       (
           SELECT stg.ccir_ind_id,
                  stg.orig_ccir_id
           FROM   EDW_WORKAREA.se stg
                  INNER JOIN best_svc bc
                       ON  stg.ccir_ind_id = bc.ccir_ind_id
           WHERE  stg.deliverability_score < '6'
                  AND stg.ccir_ind_id IN (SELECT stg.ccir_ind_id
                                          FROM   EDW_WORKAREA.se stg
                                          WHERE  stg.orig_ccir_id IS NULL
                                                 OR  stg.orig_ccir_id = ''
                                          GROUP BY
                                                 stg.ccir_ind_id
                                          HAVING COUNT(*) = 1)
       ) t

SET A.orig_ccir_id = t.orig_ccir_id
    WHERE A.ccir_ind_id = t.ccir_ind_id;

数据库中存在所有表和列。并且t中的子查询单独成功执行。

任何人都可以指出错误在哪里吗?

1 个答案:

答案 0 :(得分:2)

在Teradata上,您不应该在SET子句中限定列,因此请将SQL更改为:

update EDW_WORKAREA.bs
from (
    select ...
) t
set orig_ccir_id = t.orig_ccir_id
where EDW_WORKAREA.bs.ccir_ind_id = t.ccir_ind_id;