我想查test表的某年的12个月每个月份的数据,怎么写呀..请大哥们帮帮忙.
解决方案 »
- 一个存储过程调用报错。
- 字符串1包含字符串2,怎么把字符串1与字符串2的差异找出来
- Oracle中日期类型的问题
- 至少 只有
- java pool 问题
- 关于12560错误
- 在使用查询语句时,得到提示信息result set exceeds the maximum size
- 请问各位oracle 高手一个关于sqlldr 的问题............
- 在aix安装oracle9i的问题
- 为什么我在在ORCALE 里不可以用以用事务处理
- 在windows下的命令窗口中sqlldr、sqlplus命令都不认了?请教各位大侠
- 我想学习oracle ebs 还有BIEE,大家给点意见或好的文档啊~???
这个怎么放到select 后面啊?
就一个时间字段,
跟据这个时间字段反回12个月的数据就行
((sum(case to_char(previous_month,'mm') when '01' then score else 0 end )-(max(score)+min(score)))/(count(*)-2)) as a1,
((sum(case to_char(previous_month,'mm') when '02' then score else 0 end )-(max(score)+min(score)))/(count(*)-2)) as a2,
((sum(case to_char(previous_month,'mm') when '03' then score else 0 end )-(max(score)+min(score)))/(count(*)-2)) as a3,
((sum(case to_char(previous_month,'mm') when '04' then score else 0 end )-(max(score)+min(score)))/(count(*)-2)) as a4,
((sum(case to_char(previous_month,'mm') when '05' then score else 0 end )-(max(score)+min(score)))/(count(*)-2)) as a5,
((sum(case to_char(previous_month,'mm') when '06' then score else 0 end )-(max(score)+min(score)))/(count(*)-2)) as a6,
((sum(case to_char(previous_month,'mm') when '07' then score else 0 end )-(max(score)+min(score)))/(count(*)-2)) as a7,
((sum(case to_char(previous_month,'mm') when '08' then score else 0 end )-(max(score)+min(score)))/(count(*)-2)) as a8,
((sum(case to_char(previous_month,'mm') when '09' then score else 0 end )-(max(score)+min(score)))/(count(*)-2)) as a9,
((sum(case to_char(previous_month,'mm') when '10' then score else 0 end )-(max(score)+min(score)))/(count(*)-2)) as a10,
((sum(case to_char(previous_month,'mm') when '11' then score else 0 end )-(max(score)+min(score)))/(count(*)-2)) as a11,
((sum(case to_char(previous_month,'mm') when '12' then score else 0 end )-(max(score)+min(score)))/(count(*)-2)) as a12
from evaluate t
where referee_id in (select operator_id from operator where role_id =163) and operator_id=213如果我的01月份数据是0然后sum(0)再-去后面的(max(score)+min(score)))/(count(*)-2)) 就会出错,我不知道怎么判断.
select (sum(score)-(max(score)+min(score)))/(count(*)-2) from evaluate group by to_char(previous_month,'yyyymm');可以试试
select (sum(score)-(max(score)+min(score)))/(count(*)-2) from evaluate group by to_char(previous_month,'yyyymm');可以试试