select x.* from (
select y.evaluate_id,y.evaluate_name,y.parent_id,wm_concat(status||'_'||calc_value) retVal from (
select aaa.*,bbb.calc_value from (
select evaluate_id,t.evaluate_name,t.parent_id,a.status
from tb_bmp_evaluate_system_info t,
(select to_char(to_date('2013-03-01', 'yyyy-mm-dd') + Rownum - 1,'yyyy-mm-dd') status
from dual
connect by rownum < to_date('2013-03-21', 'yyyy-mm-dd') -
to_date('2013-03-01', 'yyyy-mm-dd') + 2) a
where t.count_method = 'SINGLE'
) aaa
,
(
select a.evaluate_name,b.evaluate_id,b.calc_value,a.evaluate_date
from (select t.*
from tb_bmp_evaluate_inst t
where t.evaluate_id in
(select evaluate_id
from tb_bmp_evaluate_system_info t
where t.count_method = 'SINGLE')
and substr(t.evaluate_date, 0, 7) = '2013-03' and t.count_freq='DAY') a,
tb_bmp_evaluate_result b
where a.evaluate_inst_id = b.evaluate_inst_id
group by a.evaluate_name,b.evaluate_id,b.calc_value,a.evaluate_date
)bbb
where aaa.evaluate_id=bbb.evaluate_id(+) and aaa.status=bbb.evaluate_date)y group by evaluate_id,evaluate_name,parent_id)x connect by prior x.evaluate_id = x.parent_id
start with x.parent_id = 1
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货