在这里我想更新 item_quatity 如果存在否则插入行
+----+--------+-----------+---------------+
| id |user_id | item_id | item_quantity |
+----+--------+-----------+----------------+
| 1 | 16 | 4 | 1 |
| 2 | 5 | 6 | 2 |
+----+--------+-----------+---------------+
INSERT INTO user_items
SET user_id = 16 ,item_id = 4 , item_quantity = 1
ON DUPLICATE KEY
UPDATE item_quantity = item_quantity + '1' ;
OR
INSERT INTO user_items
(user_id,item_id,item_quantity) VALUES ('16','4','1')
ON DUPLICATE KEY
UPDATE item_quantity= item_quantity + '1' ;
这个查询总是插入行,更新不起作用???