I would like to have an insert and update if exists operation on my db.
My table has ‘A’ defined as PRIMARY.
A int
B VARCHAR 20
TEST int
why does this query returns ‘2 row(s) inserted’ instead of 1?
insert into test1 (A, B, TEST)
values(2, "A", 19)
on duplicate key update
A=values(A), B=values(B), TEST=values(TEST)
http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
This believed to distinguish between a brand new row vs update on existing row