MySQL Query: insert if entry is duplicate otherwise update the existing row values
问题 i have a table called bag (again): +--------+----------+---------+----------+ | bag_id | chara_id | item_id | item_qty | +--------+----------+---------+----------+ | 1 | 1 | 2 | 22 | | 2 | 1 | 1 | 55 | | 3 | 3 | 1 | 2 | | 6 | 3 | 4 | 2 | | 7 | 4 | 4 | 2 | | 8 | 5 | 4 | 2 | | 9 | 6 | 4 | 2 | | 10 | 1 | 5 | 1 | | 14 | 1 | 8 | 1 | | 15 | 1 | 6 | 1 | | 18 | 1 | 4 | 1 | | 19 | 1 | 3 | 1 | | 29 | 8 | 1 | 1 | | 30 | 8 | 7 | 1 | | 33 | 6 | 2 | 1 | +--------+----------+---------+----------+ and i have