首页 > 电脑

sql2000中对查询出来的数据中某列数据做修改

更新时间2018-07-17 16:19:36

例如:

select a.item_no,item_name ,b.stock_qty ,price,status from  

t_bd_item_info a left join t_im_branch_stock b on a.item_no=b.item_no where stock_qty<>'0' and status='6'

我需要将查询出来的数据中的status='6'值改成5


如果返回数据有多行,不考虑效率,最简单的方法可以这样

update t_bd_item_info set status='5' where

status in

(

select a.item_no,item_name ,b.stock_qty ,price,status from  

t_bd_item_info a left join t_im_branch_stock b on a.item_no=b.item_no where stock_qty<>'0' and status='6'

)


上一篇:windowsXP蓝屏问题!

下一篇:一个严肃的问题