seqsever 查询多个表的条数,并以列的形式展现
select sum(a) a,sum(b) b,sum(c) c,SUM(d) d,sum(a1) a1,sum(b1) b1,sum(c1) c1,SUM(d1) d1
from
(
select case x when 'a' THEN y else 0 end a,
case x when 'b' THEN y else 0 end b,
case x when 'c' THEN y else 0 end c,
case x when 'd' THEN y else 0 end d,
case x when 'a1' THEN y else 0 end a1,
case x when 'b1' THEN y else 0 end b1,
case x when 'c1' THEN y else 0 end c1,
case x when 'd1' THEN y else 0 end d1
from
(
sELECT 'a' x,COUNT(*) y from NCR_HC_FAB2INLINE a
union all
sELECT 'b' x,COUNT(*) y from NCR_HC_FAB3INLINE b
union all
sELECT 'c' x,COUNT(*) y from NCR_HC_FAB2Offline c
union all
sELECT 'd' x,COUNT(*) y from NCR_HC_FAB3Offline d
UNION ALL
sELECT 'a1' x,COUNT(*) y from NCR_HC_FAB2INLINE a1 WHERE isnull(ifcf,'0')!='0'
union all
sELECT 'b1' x,COUNT(*) y from NCR_HC_FAB3INLINE b1 WHERE isnull(ifcf,'0')!='0'
union all
sELECT 'c1' x,COUNT(*) y from NCR_HC_FAB2Offline c1 WHERE isnull(ifcf,'0')!='0'
union all
sELECT 'd1' x,COUNT(*) y from NCR_HC_FAB3Offline d1 WHERE isnull(ifcf,'0')!='0'
) as w
) as y
最新文章
- linux 下第一个Libevent代码学习
- 剑指Offer面试题:11.打印1到最大的n位数
- IO(三)----序列流
- 一般处理程序获取WEB窗体创建的验证码需要实现session相关接口
- C++ std::map::erase用法及其陷阱
- C#窗体 流
- npm命令总结
- processor, memory, I/O
- 通过struts.xml搭建、为属性注入值_2015.01.04
- [转]UOS 中的虚拟网络设备
- 解决php json_encode 出现的中文转码、乱码问题
- html中的banner自适应屏幕代码
- linux5.8安装oracle10g过程记录,换实例一定要改profile的配置
- c#反射执行静态方法
- asp.net mvc webapi 实用的接口加密方法
- python,字符串方法
- linux连接数过多,导致ping包丢包的问题解析
- A Bayesian Approach to Deep Neural Network Adaptation with Applications to Robust Automatic Speech Recognition
- django设置并获取cookie/session,文件上传,ajax接收文件,post/get请求及跨域请求等的方法
- 027 ResourceBundle.getBundle方法