替换字段

来源:百度知道 编辑:UC知道 时间:2024/07/02 17:03:33
怎样把所有“民族”字段值为“1”的记录“民族”字段值替换为“汉族”

是sql 吗?
你是要显示 为 汉族 还是 修改?
修改:
update table set 民族='汉族' where 民族=1
显示
select case 民族 when 1 then '汉族'
else 民族 end
from table
Oracle 还有这种写法
select decode(民族,1,'汉族',民族) from table

update 表 set 民族="汉族" WHERE 汉族=1