怎么把表中满足一定条件的记录的某个列改为某个定值?

sheyu8 2003-10-20 04:55:23
如何把a表中 class=1的所有学生的State都改为'UOA'
下面这么做通不过
select State='UOA'
from A
where class=1
...全文
22 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ysycrazy 2003-10-20
  • 打赏
  • 举报
回复
update a
set state='UOA'
where class=1
伍子V5 2003-10-20
  • 打赏
  • 举报
回复
update a set state='UOA' where class=1

或则

select (case when class=1 then 'UOA' else state end) as State from a
txlicenhe 2003-10-20
  • 打赏
  • 举报
回复
update a set state='UOA' where class=1
yujohny 2003-10-20
  • 打赏
  • 举报
回复
update a
set state='UOA'
where class=1

34,576

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧