sqlserver grouping with Rollup
来源:互联网 发布:网络的英文 编辑:程序博客网 时间:2024/05/21 19:43
select
--Sdate '时间/十分钟',
case grouping(Sdate)
when 0 then Sdate
when 1 then '总计'
end as '时间/十分钟',
count (distinct orderDeputyID) as '下单数',
sum (ticketCount) as '票张数',
count ( distinct payorderDeputyID ) '支付订单数',
sum (payticketCount) '支付票单数',
count (distinct orderDeputyID) -(count ( distinct payorderDeputyID )) '未支付订单数',
sum (ticketCount) - sum (payticketCount) '未支付票单数'
from (
select substring(CONVERT(varchar(100), dateTime, 120),1,15) as Sdate
,orderDeputyID
,ticketCount
,case when orderPayment=1 then orderDeputyID
else null
end as payorderDeputyID,
case when orderPayment=1 then ticketCount
else 0
end as payticketCount
from [order] where sessionId =XXXX and orderType=9
)T group by Sdate with Rollup
0 0
- sqlserver grouping with Rollup
- 统计 sqlServer grouping with Rollup
- grouping、with rollup的用法。
- sql with rollup grouping 使用
- SQLSERVER中rollup、cube、grouping用法
- sql中 with rollup 、with cube、grouping 统计函数用法
- sql中 with rollup 、with cube、grouping 统计函数用法
- sql中 with rollup 、with cube、grouping 统计函数用法
- [MSSQL] 关于with cube ,with rollup 和 grouping
- sql中 with rollup 、with cube、grouping 统计函数用法
- with rollup 、with cube、grouping 统计函数用法
- Hive中with cube、with rollup、grouping sets用法
- SQL Server关于WITH CUBE、WITH ROLLUP和GROUPING使用
- GROUPING …. WITH ROLLUP 做分组汇总 统计(转)
- sql grouping with rollup 按部门 合并一些部门
- GROUPING SETS、ROLLUP、CUBE
- GROUPING SETS、ROLLUP、CUBE
- GROUPING SETS、ROLLUP、CUBE
- MTK Kernel启动流程源码解析 6 setup_arch
- Oracle数据库实例及监听重启
- Linux线程-互斥锁pthread_mutex_t
- 使用IntelliJ IDEA开发SpringMVC网站(二)框架配置
- IOS打包测试发布环境配置-下篇
- sqlserver grouping with Rollup
- 欢迎使用CSDN-markdown编辑器
- 用两个栈实现一个队列
- iOS开发之WKWebView代替UIWebView
- 微信高可用分布式数据库PhxSQL设计与实现
- 《痴者的2017年学习计划》---好像有点晚
- OOA、OOD、OOP (为新手讲解)
- 线程知识总结
- nyoj-非洲小孩