select biz_name biz_name, biz_code biz_code, '' dis_name, '' dis_code, '' inv_name, '' inv_id
from biz_tb
where upper(deleted)='N'
union
select a.biz_name biz_name, a.biz_code biz_code, b.dis_name dis_name, b.dis_code dis_code, '' inv_name, '' inv_id
from biz_tb a, dis_tb b
where (a.biz_code = b.biz_code(+)) and upper(a.deleted)='N' and upper(b.deleted)='N'
union
select a.biz_name biz_name, a.biz_code biz_code, b.dis_name dis_name, b.dis_code dis_code, c.inv_name inv_name, c.inv_id inv_id
from biz_tb a, dis_tb b ,inv_tb c
where upper(c.deleted)='N' and (a.biz_code = b.biz_code(+) and b.dis_code = c.dis_code(+))
order by biz_code, biz_name, dis_code, dis_name, inv_id, inv_name
위와 같이..
3개의 쿼리문을 union으로 조합해서 보여 주구 있는데..
그 중에..
젤 처음 쿼리문을 ..
select biz_code, decode(level, '1','', '--') ||biz_name ,level, nvl(up_loc_cd,biz_code) FROM biz_tb
CONNECT BY PRIOR select =up_loc_cd START WITH up_loc_cd is null order by 4,3,2,1
이렇게 수정하면..
전체쿼리문은 어케 고쳐야 하죠??
초보는..
슬픕니다.
사용할수 있는걸로 알고 있습니다...
마지막 쿼리가 아닌 중간에 order by를 사용하면 에러납니다....