본문 바로가기
DB/Mysql

CONCAT , GROUP_CONCAT 활용 JSON 문자열로 쿼리 결과 추출

by 꼬바리 2023. 9. 12.
SELECT CONCAT('[', ARR, ']') AS KEYWORD_LIST
 FROM
 (
    SELECT GROUP_CONCAT('{', ITEM, '}' SEPARATOR ',') AS ARR 
      FROM (
          SELECT CONCAT ( '"키워드" : '   , '"', tcc.COMM_CD_NM   , '"' ) AS ITEM
            FROM TB_COMM_CD tcc 
           WHERE tcc.DELETE_YN = 'N' 
            AND tcc.GROUP_CD = 'KEYWORD'
       ) AS t100
 ) t200

😎결과

 

728x90
반응형

댓글