oracle实现今年数据 去年同期和增长百分比
2014-09-01 10:06
190 查看
select c.*,round((datanow-databefore)/databefore,2)*100||'%' datapercent from (select a.auth_tztype ,a.datanow,b.databefore from
(select auth_tztype,Count(auth_tztype)datanow from t_author where auth_applydate between to_date('2011/1/1','yyyy/mm/dd hh24:mi:ss')and to_date('2011/12/31','yyyy/mm/dd hh24:mi:ss') group by auth_tztype )a
left join (select auth_tztype,Count(auth_tztype)databefore from t_author where auth_applydate between to_date('2010/1/1','yyyy/mm/dd hh24:mi:ss')and to_date('2010/12/31','yyyy/mm/dd hh24:mi:ss') group by auth_tztype ) b on a.auth_tztype=b.auth_tztype)c
红色为求百分比函数
(select auth_tztype,Count(auth_tztype)datanow from t_author where auth_applydate between to_date('2011/1/1','yyyy/mm/dd hh24:mi:ss')and to_date('2011/12/31','yyyy/mm/dd hh24:mi:ss') group by auth_tztype )a
left join (select auth_tztype,Count(auth_tztype)databefore from t_author where auth_applydate between to_date('2010/1/1','yyyy/mm/dd hh24:mi:ss')and to_date('2010/12/31','yyyy/mm/dd hh24:mi:ss') group by auth_tztype ) b on a.auth_tztype=b.auth_tztype)c
红色为求百分比函数
相关文章推荐
- 实现插入新数据字段自增长的触发器(Oracle)
- 如何快速的实现oracle数据表的的增删改?
- Struts+Oracle分页显示数据的实现
- Oracle中实现自动增长列
- 利用oracle高级复制功能实现数据同步的问题
- ORACLE没有自动增长的数据类型
- 在 Hibernate 中使用 oracle 的 sequence 产生主键实现 SQL Server 自增长字段功能
- oracle中自增长列的实现方式
- Oracle中实现透视表 根据ERN的修改后的在Block_size 16K下我实现了56万行数据透视.
- oracle的包、用户数据类型与内存表的实现
- 利用 GROUP BY 和 MAX 实现对表数据分组统计后的过滤查询(Oracle920)
- 我写的:用游标实现:查找重复数据并将重复数据加自动增长数字
- 轻松实现Access数据导入Oracle!
- 利用oracle高级复制功能实现数据同步的问题
- 在pl/sql中使用exp/imp工具实现oracle数据导出/导入
- 利用ASP实现Oracle数据记录的分页显示
- oracle中自动增长列的实现
- 从SQL Server向Oracle迁移的技术实现方案(一)数据类型的迁移
- 在pl/sql中使用exp/imp工具实现oracle数据导出/导入
- 在oracle中实现自动增长的列号(例子