数据集模板 供应商父格式医院,品牌父格是供应商,品牌右边的单元格所有父格都是供应商, 供应商名称查询的数据集sql SELECT DISTINCT h.suppler_code as 供应商code,h.suppler_name as 供应商名称 FROM T_Hospital_Maintenance h where h.hosp_no='${hosp_no}' 品牌名称查询的数据集sql SELECT DISTINCT h.brand_code as 品牌code,h.brand_name as 品牌名称,h.suppler_code,h.suppler_name FROM T_Hospital_Maintenance h where 1=1 ${if(len(hosp_no) == 0,"","and h.hosp_no = '"+hosp_no+"'")} ${if(len(SUPPLER_NAME) == 0,"","and h.suppler_code = '"+SUPPLER_NAME+"'")} ${if(len(BRAND_NAME) == 0,"","and h.brand_code = '"+BRAND_NAME+"'")} 查询按钮总查询sql select DISTINCT h.hosp_name as 医院名称, h.suppler_code as 供应商code, h.suppler_name as 供应商名称, h.brand_code as 品牌code, h.brand_name as 品牌名称, f.company_name as 单位名称, f.sales_month as 销售年月, f.initial_quantity as 期初存货数量, h.BRAND_PRICE as 品牌单价, f.cost_amount as 期初存货成本额, f.retail_price as 期初存货零售单价, f.purchase_quantity as 本月购进数量, f.purchase_amount as 本月购进金额, f.return_quantity as 本月退货数量, f.return_amount as 本月退货金额, f.sales_volumes as 本月销售数量, f.sales_cost as 本月销售成本额, f.sales_amount as 本月销售额, f.other_quantities as 本月其他发出数量, f.other_amount as 本月其他发出金额, f.balance_quantity as 期末结存数量, f.balance as 期末结存金额, f.inventory_number as 实际盘存数量, f.inventory_amount as 实际盘存金额, f.profit_loss_number as 盘亏盘盈数量, f.profit_loss_amount as 盘亏盘盈金额 from T_Hospital_Maintenance h inner join T_Frame_Stock f on h.suppler_code = f.suppler_code where 1=1 and h.brand_code=f.brand_code ${if(len(SUPPLER_NAME) == 0,"","and h.suppler_code= '"+SUPPLER_NAME+"'")} ${if(len(BRAND_NAME) == 0,"","and h.brand_code= '"+BRAND_NAME+"'")} ${if(len(SALES_MONTH) == 0,"","and f.sales_month= substr('"+SALES_MONTH+"',0,7) ")} 供应商单元格加的过滤条件,过滤 品牌数据集的供应商 code 品牌单元格加的过滤条件, 总查询加的过滤条件 查询单个供应商 预览结果 没错的 不选供应商查询所有供应商出差,值重复,品牌分组没错,奥加供应商一个品牌宝肌,右边值应该一个。显示四个,把下面供应商下品牌的值也重复了 上海恒兴供应商下三个品牌,右边值也应该三个,显示了四个,把上面供应商下品牌的值也重复了 日志sql 执行结果 求解 编辑于 2018-5-16 09:17 编辑于 2018-5-16 10:12 |