I'm writing a function for executing multiple updates at one time.
I was inspired by example code found here :
INSERT INTO table (id,Col1,Col2) VALUES (1,1,1),(2,2,3),(3,9,3),(4,10,12)
ON DUPLICATE KEY UPDATE Col1=VALUES(Col1),Col2=VALUES(Col2);
But the output of my function is like this:
INSERT INTO table (id,Col1,Col2) VALUES (1,1,1),(2,2,3),(3,9,3),(4,10,12)
ON DUPLICATE KEY UPDATE id=VALUES(id), Col1=VALUES(Col1), Col2=VALUES(Col2);
So I'm concerned that my output includes the primary key field between updates.
I tried the code and it seems to work well (including the primary key) This can generate errors that I haven't met yet? Do I have to delete the primary key from second part of the query?