SELECT ta.*, rownum
FROM (
SELECT A.CSEQ, A.PHOTO, A.GMENU, A.MENUCODE, A.REGSEQ, A.TITLE, A.SUMMARY, D.SEQ
FROM (SELECT * FROM A_CONT_SERV
WHERE SITE='MS' AND CORP = '$SITE_CORPCODE' AND GGMENU IN ($_IN_GGMENU) AND USEYN='Y') A,
(SELECT * FROM
( SELECT SEQ,SMENU,TITLE,ROW_NUMBER() OVER (ORDER BY BRODATE DESC),REGSEQ FROM M_THEMA_CONT WHERE CORPCODE='17'
) B
RIGHT OUTER JOIN
(SELECT MAX(REGDT),SEQ FROM M_THEMA
WHERE CORPCODE='17'
AND REGDT = (SELECT MAX(REGDT) FROM M_THEMA WHERE CORPCODE='17'
GROUP BY SEQ) C
ON B.SEQ=C.SEQ
AND ROWNUM >=0 AND ROWNUM <=1
) D
실행시키면 D.SEQ를 찾을 수 없다고 나옵니다. 현재 제가 하려는건 B테이블과 D테이블을 조인하려고 하는데 맞지 않나요? |