具有多个插入的重复键更新

Duplicate key update with multiple inserts

如何正确管理以下 SQL 查询的重复键更新,其中我正在进行多个插入?

INSERT into user(id, first, last) 
VALUES(1, 'f1', 'l1'), (2, 'f2', 'l2') 
ON DUPLICATE KEY UPDATE first = 'f1', last = 'l1'; // what about f2/l2?

问题: 我如何为上述查询指定多个键更新值或请帮助进行横向思考。

概述: 该项目用于从远程 json 提要进行同步。

使用VALUES:

INSERT into user(id, first, last) 
    VALUES(1, 'f1', 'l1'), (2, 'f2', 'l2') 
    ON DUPLICATE KEY UPDATE
        first = VALUES(first),
        last = VALUES(last); 

这就像一个函数(真正的语法糖),它表示将 insert 的值传递给行。