2011년 6월 2일 목요일

메뉴 생성 Query(위쪽) - 1


SELECT level,
       menu_name,
       mapp_seq,
       mst_seq,
       id,
       ref,
       DECODE(mapp_seq, 0, '', url) url,
       DECODE(mapp_seq, 0, '', param) param,
       sort_order,
       folder_sect,
       roll_over_on_img,
       roll_over_off_img
FROM   (select NVL(b.seq, 0) mapp_seq, --순번
               b.type_seq, --메뉴타입순번
               b.menu_seq, --메뉴순번
               a.id,  --메뉴ID
               a.ref,  --부모 ID
               a.url,
               a.param,
               a.menu_name,
               a.sort_order, --순서
               a.folder_sect, --폴터여부
               a.seq mst_seq,
               a.roll_over_on_img,
               a.roll_over_off_img
        FROM   메뉴테이블 a
            LEFT OUTER JOIN 매핑테이블 b
                ON  a.seq = b.menu_seq
                AND a.use_yn = 'Y'
                AND b.type_seq = 11)
WHERE  1 = 1
AND    level < 4 CONNECT BY PRIOR id = ref START WITH ref = 0
ORDER siblings BY sort_order

댓글 없음:

댓글 쓰기