日期:2014-05-17 浏览次数:20757 次
with a as( select 1001 id,'A1' type,20 value,'X' flag from dual UNION all select 1002,'A1',10,'X' from dual union all select 1003,'A2',40,'X' from dual union all select 1004,'A2',20,'Y' from dual union all select 1005,'A3',80,'Z' from dual union all select 1006,'A3',20,'Y' from dual union all select 1007,'A3',10,'Y' from dual) SELECT TYPE,SUM(VALUE),wm_concat(DISTINCT flag) FROM a GROUP BY TYPE;