select t.bib_type,
count(CASE when code.code='BBS001' then t.bib_type end) as Load,
count(decode(code.code,'BBS001',t.bib_type,'')) as Load,
count(CASE when code.code='BBS002' then t.bib_type end) as Bi,
count(CASE when code.code='BBS003' then t.bib_type end) as Unload,
count(CASE when code.code='BBS004' then t.bib_type end) as Wait,
count(CASE when code.code='BBS005' then t.bib_type end) as Hold,
count(CASE when code.code='BBS006' then t.bib_type end) as PM,
count(CASE when code.code='BBS007' then t.bib_type end) as Clean,
count(CASE when code.code='BBS008' then t.bib_type end) as Other,
--count(CASE when code.code='BBS009' then t.bib_type end) as Disabled,
count(decode(code.code,'BBS009',t.bib_type,'')) as Disabled,
count(0) total_count,
round(avg(t.mask_rate),2) mask_rate
from mcs_bib t,mcs_code_m code
where t.status=code.code and code.type='BBS' and t.status_code='0'
group by t.bib_type;
分享到:
相关推荐
通过oracle的管道技术实现行变列,或者复杂的SQL语句实现。 可以完成复杂逻辑在oracle中完成,减少对编程程序的依赖。
数据库行变列查询 数据库行变列查询 数据库行变列查询 数据库行变列查询 数据库行变列查询 数据库行变列查询
对数据库查询出的数据进行由对应的行数据变为列数据
sql语言让数据行变列显示,简单的sql语句就能实现
Oracle存储过程,实现行变列,含有2个存储过程,学习的不要放过
sql行变列说明
行变列与业务数据组合查询sql,具体业务描述及sql见具体sql编写,不清楚,可以留言讨论
sql利用union all行转列 利用最原始的方法进行行转列 简单明了
C#终极版DataTable集行转列,完全不用任何修改,可直接使用!
EXCEL中的表格,行变列,列变行文.pdf
sql语句将行转换成列 declare @sql varchar(8000) set @sql = 'select 物料代码' select @sql = @sql + ',sum(case 地区 when '''+地区+''' then 数量 end) ['+地区+']' + ',sum(case 地区 when '''+地区+'''...
oracle行转列
将列变成行的存储过程,实现分组求和 列变成行存储过程将列变成行的存储过程 列变成行存储过程将列变成行的存储过程 列变成行存储过程将列变成行的存储过程
三行三列数组
sql中把指定的列作为标题列
将SQL数据库的一列多行 数据转换为 一行多列
通用函数 指定某行某列的属性值(字体、背景颜色等)
SQL中如何实现行转列,列转行的操作.这里的例子保证让你豁然开朗!
很好的网格布局!
昨天遇到一个SQL Server的问题:需要写一个储存过程来处理几个表中的数据,最后问题出在我想将一个表的一个列的多行内容拼接成一行,比如表中有两列数据 : 类别 名称 AAA 企业1 AAA 企业2 AAA 企业3 ...