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 ' ...
随机推荐
- Android网络编程系列之Volley总结
前言 Volley的中文翻译为“齐射.并发”,是在2013年的Google大会上发布的一款Android平台网络通信库,具有网络请求的处理.小图片的异步加载和缓存等功能,能够帮助 Android AP ...
- Python+Selenium笔记(十四)鼠标与键盘事件
(一) 前言 Webdriver高级应用的API,允许我们模拟简单到复杂的键盘和鼠标事件,如拖拽操作.快捷键组合.长按以及鼠标右键操作,都是通过使用webdriver的Python API 中的Ac ...
- SQL Server复制入门(一)----复制简介 (转载)
简介SQL Server中的复制(Replication)是SQL Server高可用性的核心功能之一,在我看来,复制指的并不仅仅是一项技术,而是一些列技术的集合,包括从存储转发数据到同步数据到维护数 ...
- 转:sql语句优化
性能不理想的系统中除了一部分是因为应用程序的负载确实超过了服务器的实际处理能力外,更多的是因为系统存在大量的SQL语句需要优化. 为了获得稳定的执行性能,SQL语句越简单越好.对复杂的SQL语句,要设 ...
- 将TXT文件 导入 sqlserver数据库
情景一: 数据库已存在旧表名 old_table,列名old_column_name. 将TXT文件导入数据库已存在旧表old_table中,导入过程中需注意 数据源中列名可全部不修改 或 全部修改 ...
- 【待补充】[Linux] nc
[nc 是做什么的] [nc怎么用] 查看帮助 nc -help # 查看帮助 nc -help # 监听端口 -l, --listen Bind and listen for incoming co ...
- Python实例---模拟微信网页登录(day2)
第三步: 实现长轮询访问服务器---day2代码 settings.py """ Django settings for weixin project. Generate ...
- selenium-各种定位方法
selenium各种定位方法. https://www.red-gate.com/simple-talk/wp-content/uploads/imported/1269-Locators_table ...
- .NET Core 使用 EF 出错的解决方法
在.NET Core 项目钟(类库),使用Entity Framework,建立模型生成数据库时,失败 Could not load assembly 'xxx'. Ensure it is refe ...
- mod_php和mod_fastcgi和php-fpm的介绍,对比和性能数据
1.php中fastcgi和php-fpm是什么东西 最近在研究和学习php的性能方面的知识,看到了factcgi以及php-fpm,发现我对他们是少之又少的理解,可以说几乎是一无所知,想想还是蛮可怕 ...