使用另一个表中的数据更新Teradata表中的列

时间:2015-04-22 19:29:17

标签: sql teradata

我看过很多帖子,并按照语法编写以下查询。但仍然会出现错误“Column/Parameter wm_ad_hoc.temp.temp does not exist

请帮助弄清楚我在这里做错了什么。

UPDATE temp 
FROM   wm_ad_hoc.OWNED_ITEM_STORE_DLY temp, 
       wm_ad_hoc.OWNED_ITEM_STORE_DLY_UTIL util 
SET    temp.VENDOR_STOCK_ID = util. VENDOR_STOCK_ID, 
       temp.ON_HAND_EACH_QTY = util. ON_HAND_EACH_QTY, 
       temp.VENDOR_STOCK_ID = util.VENDOR_STOCK_ID 
WHERE  temp. VENDOR_NBR = util. VENDOR_NBR 
AND    temp.WMI_ITEM_NBR = util.WMI_ITEM_NBR 
AND    temp. store_nbr = util. store_nbr 
AND    temp.BUSINESS_DATE = util.BUSINESS_DATE

1 个答案:

答案 0 :(得分:2)

您无需限定SET列。所以:

UPDATE temp 
FROM   wm_ad_hoc.OWNED_ITEM_STORE_DLY temp, 
       wm_ad_hoc.OWNED_ITEM_STORE_DLY_UTIL util 
SET    VENDOR_STOCK_ID = util.VENDOR_STOCK_ID, 
       ON_HAND_EACH_QTY = util.ON_HAND_EACH_QTY, 
       VENDOR_STOCK_ID = util.VENDOR_STOCK_ID
...