抱歉,如果标题不清楚。基本上我试图从多个表中选择某些记录,然后为返回的记录更新某个列值。
T-SQL 实现
UPDATE
CUSTOMERS
SET
LIKES_US = 'Y'
FROM
RESTAURANT REST INNER JOIN CUSTOMERS CUST ON REST.LINK_ID = CUST.LINK_ID
WHERE
REST.REST_TYPE = 'Diner' AND CUST.LIKES_US IS NULL
甲骨文
UPDATE
(SELECT CUST.LIKES_US
FROM CUSTOMERS CUST INNER JOIN RESTAURANT REST ON CUST.LINK_ID=REST.LINK_ID
WHERE REST.REST_TYPE = 'Diner' AND CUST.LIKES_US IS NULL) NEW_CUST
SET
NEW_CUST.LIKES_US = 'Y';
我尝试在 Teradata 中执行与在 Oracle 中相同的操作,但出现以下错误:
Executed as Single statement. Failed [3707 : 42000] Syntax error, expected something like a name or a Unicode delimited identifier or an 'UDFCALLNAME' keyword between the 'UPDATE' keyword and '('.
Elapsed time = 00:00:00.003
STATEMENT 1: Unknown failed.
我在网上寻找解决方案,但没有运气。