标题:ORCLE中SQL语句这句是什么意思呀!
取消只看楼主
cao6623696
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2007-4-16
 问题点数:0 回复次数:0 
ORCLE中SQL语句这句是什么意思呀!
SELECT '合计' areaname,SUM(c1) c1,SUM(c2) c2,SUM(c3) c3,SUM(c4) c4,SUM(c5) c5,SUM(c6) c6,SUM(c7) c7,SUM(c8) c8,SUM(c9) c9,SUM(c10) c10,SUM(c11) c11,SUM(c12) c12,SUM(c13) c13,SUM(c14) c14,SUM(c15) c15,SUM(c16) c16,SUM(c17) c17,SUM(c18) c18,SUM(c19) c19,SUM(c20) c20,SUM(c21) c21,'910' oldareaid
FROM(
SELECT MAX(areaname) areaname,
SUM(DECODE(classname,'SDH',fee,0)) c1,
SUM(DECODE(classname,'出租网元',fee,0)) c2,
SUM(DECODE(classname,'SDH',fee,0)+DECODE(classname,'出租网元',fee,0)) c3,
SUM(DECODE(classname,'ATM',fee,0)) c4,
SUM(DECODE(classname,'FR',fee,0)) c5,
SUM(DECODE(classname,'MPLSVPN',fee,0)) c6,
SUM(DECODE(classname,'DDN',fee,0)) c7,
SUM(DECODE(classname,'设备出租',fee,0)) c8,
SUM(DECODE(classname,'设备代维',fee,0)) c9,
SUM(DECODE(classname,'ATM',fee,0)+DECODE(classname,'FR',fee,0)+DECODE(classname,'MPLSVPN',fee,0)+DECODE(classname,'DDN',fee,0)+DECODE(classname,'设备出租',fee,0)+DECODE(classname,'设备代维',fee,0)) c10,
SUM(DECODE(classname,'互联网专线普通',fee,0)) c11,
SUM(DECODE(classname,'互联网专线汇聚',fee,0)) c12,
SUM(DECODE(classname,'互联网专线普通',fee,0)+DECODE(classname,'互联网专线汇聚',fee,0)) c13,
SUM(DECODE(classname,'XDSL',fee,0)) c14,
SUM(DECODE(classname,'LAN',fee,0)) c15,
SUM(DECODE(classname,'其他',fee,0)) c16,
SUM(DECODE(classname,'XDSL',fee,0)+DECODE(classname,'LAN',fee,0)+DECODE(classname,'其他',fee,0)) c17,
SUM(DECODE(classname,'服务器托管',fee,0)) c18,
SUM(DECODE(classname,'机架租赁',fee,0)) c19,
SUM(DECODE(classname,'服务器托管',fee,0)+DECODE(classname,'机架租赁',fee,0)) c20,
SUM(DECODE(classname,'合计',fee,0)) c21,
oldareaid
FROM(
SELECT MAX(areaname) areaname,SUM(fee) fee,oldareaid,classname
FROM REPORT_INCOME
WHERE billingcycleid='200702'
GROUP BY oldareaid,classname
)
GROUP BY oldareaid
)
)
ORDER BY oldareaid

语句中DECODE以及后面参数是干什么的呀?我只知道SUM是统计的
搜索更多相关主题的帖子: SUM SQL ORCLE 语句 意思 
2007-04-20 09:50



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-133358-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.146760 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved