I'm able to update my table when mykey (primary key) exists, or insert when mykey does not exist, with this query:
INSERT INTO customers (id, customer_id, page_id, mykey, hits)
VALUES
(NULL, 1, 1, 23, 49) ON DUPLICATE KEY UPDATE hits=hits+49;
Works fine. Now I can't figure out how to add multiple values in one query. What I want is this:
INSERT INTO customers (id, customer_id, page_id, mykey, hits)
VALUES
(NULL, 1, 1, 23, 49) ON DUPLICATE KEY UPDATE hits=hits+49,
(NULL, 2, 2, 56, 11) ON DUPLICATE KEY UPDATE hits=hits+11,
(NULL, 3, 3, 81, 14) ON DUPLICATE KEY UPDATE hits=hits+14;
But that doesn't work. Is it possible to insert or update multiple values like this in one query?