PG清晰的Filter Where语句
SELECT "HDCD_DeptType"||'-'||"HDCD_DeptName", sum("HDCD_DetailSum") FILTER (WHERE "HDCD_TypeName"='人员费用') AS 人员费用, sum("HDCD_DetailSum") FILTER (WHERE "HDCD_TypeName"='卫生材料') AS 卫生材料, sum("HDCD_DetailSum") FILTER (WHERE "HDCD_TypeName" like('%药品%')) AS 药品费用, sum("HDCD_DetailSum") FILTER (WHERE "HDCD_TypeName"='固定资产折旧费用') AS 固定资产折旧费用, sum("HDCD_DetailSum") FILTER (WHERE "HDCD_TypeName"='无形资产摊销费') AS 无形资产摊销费, sum("HDCD_DetailSum") FILTER (WHERE "HDCD_TypeName"='提取医疗风险基金') AS 提取医疗风险基金, sum("HDCD_DetailSum") FILTER (WHERE "HDCD_TypeName"='其他运行费用') AS 其他运行费用 FROM "HospDeptCostDetail" GROUP BY "HDCD_DeptType","HDCD_DeptName" ORDER BY "HDCD_DeptType","HDCD_DeptName"