大屏图表数据分类,11.0版本

当只有第一个控件值时,分类为项目,当第一个和第二个控件都有值的时以月份分类,有两张表,sql怎样写,而且要使第一个控件选择为全部时显示全部项目不过滤

${IF(LEN(PROJECT)=0,

   "SELECT

PROJECT_NAME AS 项目,

PROJECT_TYPE AS 项目分期,

NET_PROFIT_ACT/100000000 AS 动态版净利润,

NET_PROFIT_TAR/100000000 AS 方案版净利润,

NET_PROFIT_DEVIATION/100000000 AS 净利润偏差,

NET_INTEREST_RATE_ACT AS 动态版净利率,

NET_INTEREST_RATE_TAR AS 方案版净利率,

NET_INTEREST_RATE_DEVIATION AS 净利率偏差,

CARGO_VALUE_ACT/100000000 AS 动态版货值,

CARGO_VALUE_TAR/100000000 AS 方案版货值,

CARGO_VALUE_DEVIATION/100000000 AS 货值偏差,

CARGO_COST_ACT/100000000 AS 动态版成本,

CARGO_COST_TAR/100000000 AS 方案版成本,

CARGO_COST_DEVIATION/100000000 AS 成本偏差

FROM WR_LR_FINANCE_INDEX_BY_PRO

WHERE PROJECT_TYPE = '" + TYPE + "' ",

"SELECT

DISTINCT

LEFT(MDM_TIME.FYMDAY,7) AS 年月,

WLFI.PROJECT_NAME AS 项目,

-- WLFI.YEAR_MONTHS AS 年月,

WLFI.NET_PROFIT_ACT/100000000 AS 动态版净利润,

WLFI.NET_PROFIT_TAR/100000000 AS 方案版净利润,

WLFI.NET_PROFIT_DEVIATION/100000000 AS 净利润偏差,

WLFI.NET_INTEREST_RATE_ACT AS 动态版净利率,

WLFI.NET_INTEREST_RATE_TAR AS 方案版净利率,

WLFI.NET_INTEREST_RATE_DEVIATION AS 净利率偏差,

WLFI.CARGO_VALUE_ACT/100000000 AS 动态版货值,

WLFI.CARGO_VALUE_TAR/100000000 AS 方案版货值,

WLFI.CARGO_VALUE_DEVIATION/100000000 AS 货值偏差,

WLFI.CARGO_COST_ACT/100000000 AS 动态版成本,

WLFI.CARGO_COST_TAR/100000000 AS 方案版成本,

WLFI.CARGO_COST_DEVIATION/100000000 AS 成本偏差

FROM MDM_TIME

LEFT JOIN WR_LR_FINANCE_INDEX_BY_PRO_MONTH WLFI ON WLFI.YEAR_MONTHS = LEFT(MDM_TIME.FYMDAY,7)

WHERE WLFI.PROJECT_NAME =  '"+ PROJECT +"' 

AND MDM_TIME.FYEAR = CONVERT(VARCHAR(4),GETDATE(),120)","")}

image.png

FineReport SQL 难过的过 发布于 2022-11-7 13:08
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
0
用户k6280494Lv6资深互助
发布于2022-11-7 13:27

${IF(LEN(PROJECT)=0,

   "SELECT

PROJECT_NAME AS 项目,

PROJECT_TYPE AS 项目分期,

NET_PROFIT_ACT/100000000 AS 动态版净利润,

NET_PROFIT_TAR/100000000 AS 方案版净利润,

NET_PROFIT_DEVIATION/100000000 AS 净利润偏差,

NET_INTEREST_RATE_ACT AS 动态版净利率,

NET_INTEREST_RATE_TAR AS 方案版净利率,

NET_INTEREST_RATE_DEVIATION AS 净利率偏差,

CARGO_VALUE_ACT/100000000 AS 动态版货值,

CARGO_VALUE_TAR/100000000 AS 方案版货值,

CARGO_VALUE_DEVIATION/100000000 AS 货值偏差,

CARGO_COST_ACT/100000000 AS 动态版成本,

CARGO_COST_TAR/100000000 AS 方案版成本,

CARGO_COST_DEVIATION/100000000 AS 成本偏差

FROM WR_LR_FINANCE_INDEX_BY_PRO

WHERE PROJECT_TYPE in ('" + TYPE + "')",

"SELECT

DISTINCT

LEFT(MDM_TIME.FYMDAY,7) AS 年月,

WLFI.PROJECT_NAME AS 项目,

-- WLFI.YEAR_MONTHS AS 年月,

WLFI.NET_PROFIT_ACT/100000000 AS 动态版净利润,

WLFI.NET_PROFIT_TAR/100000000 AS 方案版净利润,

WLFI.NET_PROFIT_DEVIATION/100000000 AS 净利润偏差,

WLFI.NET_INTEREST_RATE_ACT AS 动态版净利率,

WLFI.NET_INTEREST_RATE_TAR AS 方案版净利率,

WLFI.NET_INTEREST_RATE_DEVIATION AS 净利率偏差,

WLFI.CARGO_VALUE_ACT/100000000 AS 动态版货值,

WLFI.CARGO_VALUE_TAR/100000000 AS 方案版货值,

WLFI.CARGO_VALUE_DEVIATION/100000000 AS 货值偏差,

WLFI.CARGO_COST_ACT/100000000 AS 动态版成本,

WLFI.CARGO_COST_TAR/100000000 AS 方案版成本,

WLFI.CARGO_COST_DEVIATION/100000000 AS 成本偏差

FROM MDM_TIME

LEFT JOIN WR_LR_FINANCE_INDEX_BY_PRO_MONTH WLFI ON WLFI.YEAR_MONTHS = LEFT(MDM_TIME.FYMDAY,7)

WHERE WLFI.PROJECT_NAME =  '"+ PROJECT +"' 

AND MDM_TIME.FYEAR = CONVERT(VARCHAR(4),GETDATE(),120)","")}

  • 难过的过 难过的过(提问者) 在图表的分类中怎样选择呢?是选择年月呢还是选择项目
    2022-11-07 13:44 
  • 用户k6280494 用户k6280494 回复 难过的过(提问者) 把年月和项目都命名成一个名字,都叫年月或都叫项目
    2022-11-07 13:46 
  • 难过的过 难过的过(提问者) 回复 用户k6280494 当他是年月是只有数据表中的年月而不是时间表全部的年月,一到十二月全部都展示,但是目前不能显示
    2022-11-07 14:02 
  • 用户k6280494 用户k6280494 回复 难过的过(提问者) right jion( select \'1月\' as 年月 union all select \'2月\' as 年月 union all ) 用类似的方法把1-12月写出来,与主表通过时间字段关联起来
    2022-11-07 14:19 
  • 2关注人数
  • 260浏览人数
  • 最后回答于:2022-11-7 13:27
    请选择关闭问题的原因
    确定 取消
    返回顶部