sql查询数据转换问题

来源:百度知道 编辑:UC知道 时间:2024/06/23 08:19:25
在表A中有下列字段
ID
1
2
3
需要查询出所有ID号,然后把所有的ID转换成自己想要的字符串!
比如查询结果是
ID
1
2
3
转换成
ID
深圳
广州
香港
只有一个表

select case
when id=1 then '深圳'
when id=2 then '广州'
when id=3 then '香港'
end as id
from A

如果不用正则表达式。。那就用if ..else..end if
<%简略打开数据库过程
简略打开表过程
do while not rs.eof
if rs("id")=1 then
response.write "深圳"
elseif rs("id")=2 then
response.write "广州"
elseif rs("id")=3 then
response.write "香港"
end if
rs.movenext
loop
%>