Reputation: 345
how can I get the numbers of inserted rows, and duplicates, after an "INSERT IGNORE ... FROM".
when I execute the query I can see that on the output:
0 row(s) affected Records: 1530 Duplicates: 0 Warnings: 0
I can get affected rows with ROW_COUNT(), How can I get the duplicates field ?
Upvotes: 2
Views: 1165
Reputation: 3823
Did you try INSERT ... ON DUPLICATE KEY UPDATE?
INSERT INTO table (a,b,c) VALUES (1,2,3)
ON DUPLICATE KEY UPDATE dublicate_flag = 1;
And after it:
SELECT COUNT(*) FROM table WHERE dublicate_flag = 1;
Upvotes: 1