当只有第一个控件值时,分类为项目,当第一个和第二个控件都有值的时以月份分类,有两张表,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)","")} |