How about using a temporary table and a multi table UPDATE statement:
-- create a temptable with update 'specifications': -- fid=3 : change (leechers, seeders, completed) to (7,8,9) -- fid=2 : change (leechers, seeders, completed) to (4,5,6) create temporary table updates ( fid int, new_leechers int, new_seeders int, new_completed int ); insert into updates values (3, 7, 8, 9), (2, 4, 5, 6);
update xbt_files, updates set xbt_files.leechers = updates.new_leechers, xbt_files.seeders = updates.new_seeders, xbt_files.completed = updates.new_completed where xbt_files.fid=updates.fid;
How about using a temporary table and a multi table UPDATE statement:
-- create a temptable with update 'specifications':
-- fid=3 : change (leechers, seeders, completed) to (7,8,9)
-- fid=2 : change (leechers, seeders, completed) to (4,5,6)
create temporary table updates (
fid int,
new_leechers int,
new_seeders int,
new_completed int
);
insert into updates values (3, 7, 8, 9), (2, 4, 5, 6);
update xbt_files, updates leechers = updates. new_leechers, new_seeders, completed = updates. new_completed fid=updates. fid;
set
xbt_files.
xbt_files.seeders = updates.
xbt_files.
where
xbt_files.