I need to update over 3000 rows but it gets too slow if I run 3000+ update queries.
(This is the table I want to update)
items (
id INT(11) NOT NULL,
name VARCHAR(255) NOT NULL,
members_only TINYINT(1) NOT NULL,
price INT(11) NOT NULL,
PRIMARY KEY (id)
);
So I was thinking about if there is a way to update multiple rows at once like this (since It should run faster if, in someway, I combine them all).
UPDATE items SET name='name1', members_only=1, price=20 WHERE id=1 AND
SET name='name2', members_only=0, price=70 WHERE id=2 AND
SET name='name3', members_only=0, price=40 WHERE id=3...;