1. 程式人生 > >SQL語句的寫法:update語句中 case...when 用法

SQL語句的寫法:update語句中 case...when 用法

update語句結合case when例子:

根據master_id和class_idx來更新資料

如圖:


sql語句:update table_name  

set ins_comp_id='111',bxgs_fl_id='111',

total_money = 

case class_idx when 'JQX' then '900' when 'SYX' then '2300'  else null end

where a.master_id='739E4rMaTt2ys6Wum32gqw';