EM:
select root_id,root_name,sum(times) from
(select connect_by_root(spaceid) root_id,spaceid,connect_by_root(spaceName)root_name,spacename from spaceinfo connect by prior spaceid=spacenum start with spacenum=-1) s
,zuserinfo u
,ztimeinfo t where s.spaceid=u.spaceid and u.userid=t.userid
group by root_id,root_name
order by root_id;
核心:
(以C为根节点,以A=B为关系条件的树形结构)
connect by piror A=B start with C=?