在SQL中如何使用case...end与as字句
selectcardidas'账号',tradeType=casewhentradeType=1then'存款'whentradeType=2then'取款'end,tr...
select cardid as '账号',tradeType=
case
when tradeType=1 then '存款'
when tradeType=2 then '取款'
end
,tradeMoney as '交易金额',tradeDate as '交易日期' from TradeInfo
go
与
select cardid as '账号',tradeType=
case
when tradeType=1 then '存款'
when tradeType=2 then '取款'
end
as '交易类型',tradeMoney as '交易金额',tradeDate as '交易日期' from TradeInfo
go
这两个语句
要将图中的tradeType转换成'交易类型' 展开
case
when tradeType=1 then '存款'
when tradeType=2 then '取款'
end
,tradeMoney as '交易金额',tradeDate as '交易日期' from TradeInfo
go
与
select cardid as '账号',tradeType=
case
when tradeType=1 then '存款'
when tradeType=2 then '取款'
end
as '交易类型',tradeMoney as '交易金额',tradeDate as '交易日期' from TradeInfo
go
这两个语句
要将图中的tradeType转换成'交易类型' 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询