Reputation: 451
I'm doing large number of:
INSERT.... ON DUPLICATE KEY UPDATE
queries and I want to find out the number of rows affected, ideally the number updated and the number inserted.
At the moment I'm using ROW_COUNT() but that counts as 2 from the above sql if the row is updated or 1 if it is inserted.
Is there a way to find this from a mysql function?
Upvotes: 0
Views: 424
Reputation: 7804
With ON DUPLICATE KEY UPDATE
, the affected-rows value is 1
, if update its 2
. From this you can determine how many rows inserted successfully and how many are updated
Upvotes: 1