728x90
반응형
SELECT AA.*, (SELECT BODY_TEXT
FROM LIFE_NEWS_T WHERE CONTENT_ID = AA.CONTENT_ID
AND ROWNUM = 1) AS BODY_TEXT -- CLOB 타입
FROM
(SELECT
A.CONTENT_ID -- 내용식별코드
, MAX(A.SEQ_LIFE_NEWS) "SEQ_LIFE_NEWS"
,MAX(A.NEWS_TYPE) "NEWS_TYPE" -- CODE_EXT_T 참조(속보,지역뉴스,포토)
,MAX(A.REGI_DATE) "REGI_DATE" -- 뉴스등록일
,MAX(A.NEWS_REGION_TYPE) "NEWS_REGION_TYPE" -- CODE_EXT_T 참조
,MAX(A.TITLE ) "TITLE" -- 뉴스 타이틀
,MAX(A.SEND_TIME) "SEND_TIME" -- 뉴스송신일
,MAX(A.EDIT_DATE) "EDIT_DATE" --
FROM LIFE_NEWS_T A
WHERE NEWS_SUB_TYPE_LIST LIKE '%%'
GROUP BY CONTENT_ID) AA
ORDER BY AA.REGI_DATE;
FROM LIFE_NEWS_T WHERE CONTENT_ID = AA.CONTENT_ID
AND ROWNUM = 1) AS BODY_TEXT -- CLOB 타입
FROM
(SELECT
A.CONTENT_ID -- 내용식별코드
, MAX(A.SEQ_LIFE_NEWS) "SEQ_LIFE_NEWS"
,MAX(A.NEWS_TYPE) "NEWS_TYPE" -- CODE_EXT_T 참조(속보,지역뉴스,포토)
,MAX(A.REGI_DATE) "REGI_DATE" -- 뉴스등록일
,MAX(A.NEWS_REGION_TYPE) "NEWS_REGION_TYPE" -- CODE_EXT_T 참조
,MAX(A.TITLE ) "TITLE" -- 뉴스 타이틀
,MAX(A.SEND_TIME) "SEND_TIME" -- 뉴스송신일
,MAX(A.EDIT_DATE) "EDIT_DATE" --
FROM LIFE_NEWS_T A
WHERE NEWS_SUB_TYPE_LIST LIKE '%%'
GROUP BY CONTENT_ID) AA
ORDER BY AA.REGI_DATE;
[출처] CLOB 타입 있을경우 GROUP BY 방법|작성자 신강유
728x90
반응형
'SQL > CLOB' 카테고리의 다른 글
ORACLE CLOB LIKE ,REPLACE (0) | 2015.11.03 |
---|---|
*clob데이타 형 like 검색 (0) | 2015.11.03 |
ibatis & CLOB insert & select (0) | 2015.11.03 |