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?
With
ON DUPLICATE KEY UPDATE, the affected-rows value is1, if update its2. From this you can determine how many rows inserted successfully and how many are updated