oracle一张表中实现多个字段的统计(多个count)
2012-12-04 17:37
337 查看
恰好在项目里看到,其实语句里面一下东西我还不理解,先记下来,有时间学习后再补充。
select count(case when A_FSSJ1 >= trunc(sysdate,'month') and A_FSSJ1 <=trunc(last_day(sysdate)) then 'un_deal' end) byfa, count(case when A_FSSJ1 >= trunc(add_months(sysdate,-1),'month') and A_FSSJ1 <=trunc(last_day(add_months(sysdate,-1))) then 'un_deal' end) hbfa, count(case when A_FSSJ1 >= trunc(add_months(sysdate,-12),'month') and A_FSSJ1 <=trunc(last_day(add_months(sysdate,-12))) then 'un_deal' end) tbfa from case_qsaj where a_ajlb2=?
相关文章推荐
- oracle小记之一张表中实现多个字段的统计(多个count)
- Oracle一张表中实现多个字段的统计(多个count)
- oracle小记之一张表中实现多个字段的统计(多个count)
- Oracle一张表中实现对一个字段不同值和总值的统计(多个count)
- Oracle一张表中实现多个字段的统计(多个count)
- Oracle一张表中实现多个字段的统计
- 统计查询-根据条件进行count的两种实现方式- oracle
- 统计查询-根据条件进行count的两种实现方式- oracle
- oracle中创建insert select from 语句实现两个表中某一个字段相同统计其他不同字段的情况
- ORACLE 连接某个字段及分组后取某个字段最大(最小)等实现方法
- 简单三步轻松实现ORACLE字段自增
- 【转】ORACLE自增长字段实现
- Oracle 统计一个字段中某字符出现的次数
- oracle 实现多字段匹配一个关键字查询语句
- 如何在野狗中实现 Count 和 自增字段
- Oracle 用merge 实现对一张表的操作存在则修改不存在则插入
- oracle sum case when group by,同时使用,实现分组统计
- oracle中使用序列和触发器实现单个字段值自增长
- Hive实现wordcount的统计
- Oracle 自动生成编号(实现sqlserver自增长字段)