SQL case when 的使用以及别名问题 [ 新手入门 ]
select
htlb,
sum(HTZJE) as ysje,--预算金额
sum(yfje) as ljfse,--累计发生额
sum(jyje) as jyje,--结余金额
(sum(jyje) / sum(HTZJE)) as jezb, --结余占比
(sum(yfje) / sum(HTZJE)) as fyzb,--费用占比
case htlb
when '1' then 'cblb1'
when '2' then 'cblb2'
when '3' then 'cblb3'
ELSE '其他' END bieMing
from tb_table
group by htlb
共 0 条回复
没有找到数据。
PHP学院的中学生
注册时间:2018-10-23
最后登录:2025-03-24
在线时长:168小时46分
最后登录:2025-03-24
在线时长:168小时46分
- 粉丝29
- 金钱4730
- 威望30
- 积分6710