快逸报表工具单数据集版本和多数据集版本的主要
区别之一,深度经验总结:
为了展现复杂含有计
算报表必须要union多个子查询出来形成一个数据
集
我现在是子查询1 union all 子查询2 union all 子
查询3 =ds1 (ds1是报表展示用的数据集)
如果支持
多数据集的话就可以ds1=子查询1 ds2=子查询2
ds3=子查询3
然后把ds1, ds2, ds3 分别配置到报表
中展现互相不影响,可以把统计计算挪到报表中做
而不是现在oracle中算出来
;
这就像金庸小说里的人物 用很简陋的兵器练习高
级武功 等练成后再用高级兵器 就威力巨大了
SELECT *
FROM ST_YEAR_PEI_LINE_GRID,
LF_CTRL_POWERLEVEL,
LF_CTRL_POWER_GRID_TYPE,
LF_CTRL_VERSION
WHERE ST_YEAR_PEI_LINE_GRID.VERSIONID = LF_CTRL_VERSION.ID
AND ST_YEAR_PEI_LINE_GRID.POWERLEVELID = LF_CTRL_POWERLEVEL.POWERLEVELID
AND ST_YEAR_PEI_LINE_GRID.GRIDTYPE = LF_CTRL_POWER_GRID_TYPE.ID
AND ST_YEAR_PEI_LINE_GRID.NETID = 20
AND LF_CTRL_VERSION.ID = 2
AND ST_YEAR_PEI_LINE_GRID.YEAR = 2015
--
UNION ALL
SELECT
SUM(ST_YEAR_PEI_LINE_GRID.Uplinearea224)
FROM ST_YEAR_PEI_LINE_GRID,
LF_CTRL_POWERLEVEL,
LF_CTRL_VERSION,
LF_CTRL_POWER_GRID_TYPE
WHERE ST_YEAR_PEI_LINE_GRID.GRIDTYPE = LF_CTRL_POWER_GRID_TYPE.ID
AND ST_YEAR_PEI_LINE_GRID.POWERLEVELID =
LF_CTRL_POWERLEVEL.POWERLEVELID
AND ST_YEAR_PEI_LINE_GRID.VERSIONID = LF_CTRL_VERSION.ID
AND LF_CTRL_VERSION.ID = 2
AND ST_YEAR_PEI_LINE_GRID.POWERLEVELID = 2
AND ST_YEAR_PEI_LINE_GRID.NETID = 20
AND ST_YEAR_PEI_LINE_GRID.YEAR = 2015
GROUP BY ST_YEAR_PEI_LINE_GRID.NETID,LF_CTRL_POWERLEVEL.POWERLEVEL
--
UNION ALL
SELECT *
FROM ST_YEAR_PEI_LINE_SUP,
LF_CTRL_POWERLEVEL,
LF_CTRL_SUPPLY_TYPE,
LF_CTRL_VERSION
WHERE ST_YEAR_PEI_LINE_SUP.Powerlevelid=LF_CTRL_POWERLEVEL.Powerlevelid
AND ST_YEAR_PEI_LINE_SUP.Supplytypeid=LF_CTRL_SUPPLY_TYPE.ID
AND ST_YEAR_PEI_LINE_SUP.Versionid=LF_CTRL_VERSION.ID
AND ST_YEAR_PEI_LINE_SUP.Netid=20
AND ST_YEAR_PEI_LINE_SUP.Year=2015
AND LF_CTRL_VERSION.ID=2