EAS_BI(扩展报表)
case when 的使用
1.
SELECT detail.resource, detail.producename, SUM(mdje), SUM(wdje), SUM(zlje), SUM(yhlje)
FROM
(
SELECT master.resource, master.producename,
(CASE WHEN fenlu.item = '密度' THEN fenlu.fee ELSE 0 END) AS mdje,
(CASE WHEN fenlu.item = '温度' THEN fenlu.fee ELSE 0 END) AS wdje,
(CASE WHEN fenlu.item = '质量' THEN fenlu.fee ELSE 0 END) AS zlje,
(CASE WHEN fenlu.item = '氧含量' THEN fenlu.fee ELSE 0 END) AS yhlje
FROM changesheet AS MASTER LEFT JOIN fenlu ON fenlu.sheetid = master.id
) AS detail
GROUP BY detail.resource, detail.producename
2.计数
sex sex = sex =
还有一个需要注意的问题,Case函数只返回第一个符合条件的值,剩下的Case部分将会被自动忽略。
--比如说,下面这段SQL,你永远无法得到“第二类”这个结果
col_1 ( , ) col_1 ()
select
case when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'g正高级'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'g高级'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'g中级'
when PostLevel.fnumber not in ('','','') and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'g初级以下'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'z正高级'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'z高级'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'z中级'
when PostLevel.fnumber not in ('','','') and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'z初级以下'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber not in ('','') then 'y正高级'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber not in ('','') then 'y高级'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber not in ('','') then 'y中级'
when PERSONTECHPOST.fishightechnical = '' and ftechnicalpostid is not null then '职称重复'
else 'y初级以下'
end job,
count(*) number
from T_BD_PERSON as PERSON
left join T_ORG_POSITIONMEMBER as POSITIONMEMBER on PERSON.fid = POSITIONMEMBER.fpersonid
left join T_ORG_POSITION as POSITION on POSITION.fid = POSITIONMEMBER.fpositionid left join T_HR_BDEMPLOYEETYPE as BDEMPLOYEETYPE on BDEMPLOYEETYPE.fid = PERSON.femployeetypeid
left join T_BD_EmployeeModle as EmployeeModle on EmployeeModle.fid = BDEMPLOYEETYPE.femployeemodleid
left join ct_mp_gwfl as GWFL on GWFL.fid = POSITION.cfgwflid
left join T_ORG_BaseUnit as BaseUnit on BaseUnit.fid = POSITION.fadminorgunitid
left join T_HR_PERSONTECHPOST as PERSONTECHPOST on PERSON.fid = PERSONTECHPOST.fpersonid
left join T_HR_BDTechPostLevel as PostLevel on PERSONTECHPOST.cflevelid = PostLevel.fid
left join T_HR_PersonPosition as PersonPosition on PERSON.fid = PersonPosition.fpersonid
where POSITIONMEMBER.fisprimary = ''and EmployeeModle.fnumber = 01 and BaseUnit.FLONGNUMBER like '%@orgnum%'
and PersonPosition.fenterdate <= {ts '@date'} and PERSONTECHPOST.fconferdate <= {ts '@date'}
group by
case when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'g正高级'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'g高级'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'g中级'
when PostLevel.fnumber not in ('','','') and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'g初级以下'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'z正高级'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'z高级'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'z中级'
when PostLevel.fnumber not in ('','','') and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber = '' then 'z初级以下'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber not in ('','') then 'y正高级'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber not in ('','') then 'y高级'
when PostLevel.fnumber = '' and PERSONTECHPOST.fishightechnical = '' and GWFL.fnumber not in ('','') then 'y中级'
when PERSONTECHPOST.fishightechnical = '' and ftechnicalpostid is not null then '职称重复'
else 'y初级以下'
end
格式化
日期
截取月日
小数位数
获取年龄
IN运算符
ksql 中对参数日期的处理
ksql日期范围查询
条件匹配
IF
(
COUNTA
(
SELECT
(
分配单, LEADERNAME, , AND(FBIZOBJID=A3, LEADERNAME=H2)
)
) = 0,
" ", "△"
)
counta
=IF(COUNTA(SELECT(分配单, LEADERNAME, , AND(FBIZOBJID = A3, LEADERNAME = H2))) = 0, " ", "△")
斑马线背景色
IF
(
MOD(ROW(), 2) = 1, RGB(213, 217, 211), RGB(255, 255, 255)
)
Case条件判断
{
CASE
(
FIELD(天津天保控股贷款情况一览表_LYC, 担保方式) = 1, "保证",
FIELD(天津天保控股贷款情况一览表_LYC, 担保方式) = 2, "抵押",
FIELD(天津天保控股贷款情况一览表_LYC, 担保方式) = 3, "质押",
FIELD(天津天保控股贷款情况一览表_LYC, 担保方式) = 4, "信用",
FIELD(天津天保控股贷款情况一览表_LYC, 担保方式) = 5, "其它",
FIELD(天津天保控股贷款情况一览表_LYC, 担保方式) = 6, "混合",
FIELD(天津天保控股贷款情况一览表_LYC, 担保方式) = 7, "无担保",
""
)
}
行隐藏
--行隐藏
IF
(
VALUE(M2) = 0, True, False
)
合并字符串 ARRAYTEXT
ARRAYTEXT({",", "", "", True, True}, EXS(B2))
ARRAYTEXT
(
{",", "", "", True, True}, O2, P2, Q2
) IF
(
SELECT1
(
天津天保控股贷款情况一览表_担保抵押, 担保单位, AND(FPARENTBILLID=E2, 方式=1)
) = Null,
"",
ARRAYTEXT
(
{"", "担保人:", "", True, True},
SELECT1
(
天津天保控股贷款情况一览表_担保抵押, 担保单位, AND(FPARENTBILLID=E2, 方式=1)
)
)
)
EAS_BI(扩展报表)的更多相关文章
- 扩展报表-JavaSet
前言 使用商业分析中的扩展报表平台,可以很方便的进行数据分析,进行图表化直观展示.一般情况下使用SQL数据集进行SQL的编写,进而配合扩展报表平台进行数据分析图表的绘制,但SQL数据集针对固定的参数进 ...
- 查看表之间的关系 需要在eas中的商业分析-扩展报表中心-报表平台下的语义层方案管理
查看表之间的关系 需要在eas中的商业分析-扩展报表中心-报表平台下的语义层方案管理
- MyBean通用报表插件介绍
特性: 1.基于MyBean插件平台.可以在任何插件中无缝调用显示. 2.其他窗体中无需引用报表控件.就可以拥有报表的设计预览打印等功能. 3.甚至可以不用带包,制作报表插件,也就是说你可以将RM的报 ...
- VUE 开发报表,非编码方式
官网:http://doc.sougn.com 下载地址:https://pan.baidu.com/share/init?surl=P0O9sjfzC8nuQxirDfjW1A 密码:4oev 先 ...
- 试图使用未在此报表服务器中注册或此版 Reporting Services 不支持的数据扩展插件“Devart.Data.PostgreSql”
数据源用的是Postgresql 我在Deploy Report的时候出现这条ErrorMessage Error 2 试图使用未在此报表服务器中注册或此版 Reporting Services 不支 ...
- 报表开发之扩展GROUP BY
在实际运用中.比方在数据仓库中,常常须要对数据进行多维分析.不仅须要标准分组的结果(相当于 GROUP BY),还须要不同维度的小计(简单 GROUP BY 中取部分列分组)和合计(不分组).从而 提 ...
- cassandra mongodb选择——cassandra:分布式扩展好,写性能强,以及可以预料的查询;mongodb:非事务,支持复杂查询,但是不适合报表
Of course, like any technology MongoDB has its strengths and weaknesses. MongoDB is designed for OLT ...
- 如何配置报表服务器扩展部署(Reporting Services 配置)
Reporting Services 支持扩展部署模式.该模式允许运行共享单个报表服务器数据库的多个报表服务器实例. 若要创建扩展部署,请使用安装程序和 Reporting Services 配置工具 ...
- AX2012R2使用SQL Server2014安装报表扩展报错
尝试在SQL Server2014上安装AX2012 R2的Reporting Services扩展失败,出现如下错误: "Could not load file or assembly ' ...
随机推荐
- Java学习笔记之异常处理
一.异常的分类 1.由Java虚拟机抛出的异常(Error):程序无法处理的问题,用户不用去进行处理(虚拟机错误丶内存溢出错误丶线程死锁) 2.Exception异常:程序本身可以进行处理的异常 1. ...
- 【Redis】Redis学习(五) Redis cluster模式详解
一般情况下,使用主从模式加Sentinal监控就可以满足基本需求了,但是当数据量过大一个主机放不下的时候,就需要对数据进行分区,将key按照一定的规则进行计算,并将key对应的value分配到指定的R ...
- Node.js ORM框架Sequlize之表间关系
Sequelize模型之间存在关联关系,这些关系代表了数据库中对应表之间的主/外键关系.基于模型关系可以实现关联表之间的连接查询.更新.删除等操作.本文将通过一个示例,介绍模型的定义,创建模型关联关系 ...
- 借助 Java 9 Jigsaw,如何在 60 秒内创建 JavaFX HelloWorld 程序?
[编者按]本文作者为 Carl Dea,主要介绍利用 Jigsaw 项目在大约一分钟内编写标准化的"Hello World"消息代码.本文系国内 ITOM 管理平台 OneAPM ...
- git中设置代理,本地不使用代理,针对域名设置代理
想要的效果是: [1]本地IP不使用代理 [2]外网的仓库(如GitHub)使用代理 [3]适用于全局 方案 打开路径: C --> 用户 --> [我的账号] --> .gitco ...
- .NET笔试题集(四)
转载于:http://www.cnblogs.com/ForEvErNoME/archive/2012/09/10/2678727.html 1.请你简单的说明数据库建立索引的优缺点 使用索引可以加快 ...
- JVM & GC 笔记
0. 说明 转载并修改自JVM 1. JVM 1.1 什么是JVM JVM为Java虚拟机(Java Virtual Machine) Runtime data area,运行时数据区. 包含5个区域 ...
- 经典Paxos算法笔记
介绍 Paxos算法是一个高容错性的分布式一致性算法.去年学习过Paxos算法,一直没将整理到博客.现在将经典Paxos算法相关内容整理到博客上. 经典Paxos算法本身也并不是太难理解,Lampor ...
- word怎样从第三页开始设置页码
一般的文件都是有封面,目录.然后才是正文.所以基本上第一页的封面,第二页是目录,第三页才是正文的开始.但是默认的页码会从第一页开始的,封面上海有页码这会很难看,今天和小编一起来看看怎样将页码从第三页开 ...
- MySQL keepalived 双主.md
MySQL keepalived 双主搭建 环境说明 系统 IP 主机名 mysql keepalived VIP CentOS 6.8 192.168.197.61 C6-node1 5.6.36 ...