Comment 5 for bug 692669

Revision history for this message
Sergey Petrunia (sergefp) wrote :

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;