When I update a value in Mysql the affected rows is 0 when the value to be updated is the same as the new value, otherwise it is 1. What is the value of affected rows, when I use insert on duplicate key update in this situation. Is it 0 or is it 2? I can't find it in the docs.
1 Answer
If your database supports duplicate keys, there will be 1 row affected. If your database does not support it, you will get an error.
edit: http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html since I misunderstood the question.
2 Comments
rsdrsd
I mean "insert ... on duplicate key" query. What i the affected rows value if the updated value is the same as the new value.
Nzall
apologies. dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html explains it, including the affected row count.