在DB2中,我可以写
MERGE INTO Table1 AS A
USING (
SELECT *
FROM TABLE2
WHERE NO.1 = NO.2) AS B ON
A.TOKEN_ID = B.TOKEN_ID
WHEN MATCHED THEN UPDATE
SET A.LINK_POSTING_IND = 1;
但是MYSQL不支持MERGE,那么如何在MYSQL中重新编写此代码?
答案 0 :(得分:0)
您可以使用更新联接在MySQL中重新定义合并语句:
UPDATE Table1 A
INNER JOIN
(
SELECT TOKEN_ID
FROM TABLE2
WHERE NO.1 = NO.2
) B
ON A.TOKEN_ID = B.TOKEN_ID
SET
LINK_POSTING_IND = 1;