0

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 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I mean "insert ... on duplicate key" query. What i the affected rows value if the updated value is the same as the new value.
apologies. dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html explains it, including the affected row count.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.