34,590
社区成员
发帖
与我相关
我的任务
分享
sample:
UPDATE b
SET bno = CASE id WHEN 1 THEN 'ddd' ELSE 'eee' END
FROM book b
id Bno Bclass Bchubanshe Bzuozhe
----------- ---- ------------ ------------------------------ --------------------
1 ddd f d f00
2 eee a a a00
3 eee f df f00
4 eee sdf asdf sdf00
7 eee sdf fdsa sdf00
12 eee df a df00
(6 row(s) affected)
update employee set last_balance=
case c.u when 0 then
ISNULL((select top 1 charge_money from c where emp_id=employee.emp_id order by op_date),0)+
ISNULL((select top 1 card_balance from c where emp_id=employee.emp_id order by op_date),0)
from c where employee.emp_id ='060359'
else
ISNULL((select top 1 card_balance from c where emp_id=employee.emp_id order by op_date),0)-
ISNULL((select top 1 charge_money from c where emp_id=employee.emp_id order by op_date),0) end
from c where employee.emp_id ='060359'