There is a table of the form id | p1 | p2 | p3 id | p1 | p2 | p3 id | p1 | p2 | p3 , where id is the primary key.
I update several lines at once with a query:
INSERT INTO `table` (id, p1, p2, p3) VALUES (1, 0.1, 0.2, 0.3), (2, 0.1, NULL, 0.3), (3, NULL, 0.2, 0.3) ON DUPLICATE KEY UPDATE p1=VALUES(`p1`), p2=VALUES(`p2`), p3=VALUES(`p3`) Question: how to change the query so that the NULL values are ignored and the old values remain in the database? Somehow type p1=VALUES(p1) IF NOT NULL , I can not figure out.