1,switch case when end用法
select LX,
CASE
WHEN LX='01' THEN '转收'
WHEN LX='02' THEN '转付'
end 更改字段名称 from 表名
select temp.d 日期,
sum(temp.callin) 字段1,
sum(temp.kp) 字段2,
sum(temp.lp) 字段3,
sum(temp.kplp) 字段4
from (select to_char(p.starttime, 'yyyy-MM-dd') d,
1 callin,
(select 1
from ucc_rms_recorderlog kp
where kp.listen_id = p.uuid) kp,
(case
when lp.uuid is null then
0
else
1
end) lp,
(select 1
from ucc_rms_recorderlog kp
where kp.listen_id = lp.uuid) kplp
from cc_tivr_visitlist p, cc_ivr_suilu lp
where p.nodeid like '0.4%'
and p.uuid = lp.uuid(+)
and p.starttime between to_date('2018-01-01', 'yyyy-MM-dd') and
to_date('2018-04-20', 'yyyy-MM-dd')
and p.isrightflow = '1'
) temp
group by temp.d
order by temp.d