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 ' ...
随机推荐
- 关于win10下JDK环境变量的配置以及关于JDK的一些说明
一.JDK的下载和安装 这里提供32位和64位JDK的下载链接 百度网盘:https://pan.baidu.com/s/1xtiVOE2gPCvlGCTy0vfBaw 密码:c5m4 官网:ht ...
- Expo大作战(二十八)--expo sdk api之Speach(语音文字转换),Segment
简要:本系列文章讲会对expo进行全面的介绍,本人从2017年6月份接触expo以来,对expo的研究断断续续,一路走来将近10个月,废话不多说,接下来你看到内容,讲全部来与官网 我猜去全部机翻+个人 ...
- Linux内存寻址之分段机制及分页机制【转】
前言 本文涉及的硬件平台是X86,如果是其他平台的话,如ARM,是会使用到MMU,但是没有使用到分段机制: 最近在学习Linux内核,读到<深入理解Linux内核>的内存寻址一章.原本以为 ...
- Software Engineer’s path to the best annual performance review
http://michaelscodingspot.com/2017/06/04/software-engineers-path-best-annual-performance-review/ How ...
- T-SQL应用实例
实验一:实验案例一(附加“练习用的可以附加的数据库--class”) 1.在products表中查询出厂日期晚于2014年4月的水果信息. select * from products where ...
- 1.2环境的准备(二)之Pycharm的安装和使用
目录: 1.Pycharm的安装 2.Pycharm的使用 (一)pycharm的安装: (1)官网下载:(分为两个版本,专业版和社区版,社区版就足够我们学习用的)https://www.jetbra ...
- JQuery 学习笔记-2017.05.22
JQuery jQuery 是一个 JavaScript 函数库. jQuery 库包含以下特性: HTML 元素选取 HTML 元素操作 CSS 操作 HTML 事件函数 JavaScript 特效 ...
- bootstrap模态框input不能获取焦点并编辑【转】
Bootstrap模态框时input标签[日期控件也有这样的问题]不能编辑的问题,下面是我的解决方法: 1.将下图中框出来的属性删掉即可: 2.兼容火狐浏览器,笔者在火狐中还是不能编辑,去掉下图属性即 ...
- BZOJ3236:[AHOI2013]作业(莫队,分块)
Description Input Output Sample Input 3 4 1 2 2 1 2 1 3 1 2 1 1 1 3 1 3 2 3 2 3 Sample Output 2 2 1 ...
- 模糊查询SSD_DATA盘谁使用率高?
select sum(bytes / 1024 / 1024 / 1024), d.owner, d.segment_name, d.segment_type f ...