为什么“插入或更新”中的命令更新工作不对?

时间:2014-09-11 18:34:08

标签: mysql sql

INSERT INTO `Users`
                (ID,FirstName,LastName) 
                    VALUE 
                ('60','Alex','Mathew') 
                ON DUPLICATE KEY 
                UPDATE 
                    FirstName = 'Alex' AND LastName = 'Mathew'

ID - is the Unique key

插入有效,但将FirstName更新为' 0'。错误在哪里?

1 个答案:

答案 0 :(得分:3)

测试它:

INSERT INTO `Users`
                (ID,FirstName,LastName) 
                    VALUE 
                ('60','Alex','Mathew') 
                ON DUPLICATE KEY 
                UPDATE 
                    FirstName = 'Alex', LastName = 'Mathew'

在','

上更改AND