我有一个yytable的表,字段为datetime,type,money
数据是这样存的
datetime type money
2004-1-1 1 10
2004-1-2 2 20
2004-1-3 3 30现在我要输出记录,如何把数据库中的type字段的值:1,2,3
转化成相应的汉字: 小型,中型,大型;来输出?
如 1=小型
.
是要用sql语句进行一下转化!
数据是这样存的
datetime type money
2004-1-1 1 10
2004-1-2 2 20
2004-1-3 3 30现在我要输出记录,如何把数据库中的type字段的值:1,2,3
转化成相应的汉字: 小型,中型,大型;来输出?
如 1=小型
.
是要用sql语句进行一下转化!
1 小型
2 中型
3 大型
when 2 then '中型'
when 3 then '大型' end
as Type
from..
select sum(money) from yytable--总金额
的方法是对的
when 2 then '中型'
when 3 then '大型' end
as Type
from..
===================
正解!