一张表中的批量更新update

update [db] set num=case id
     when 1 then 0
     when 2 then 1
     when 4 then 5
     when 6 then 3
     when 9 then 4
     when 41 then 9
     when 55 then 10
     when 68 then 5
     when 110 then 1
     when 150 then 4
     when 1 then 8) where id in (1,2,4,6,9,41,55,68,110,150)

你可能感兴趣的:(update)