mysql中json数据的拼接方式

    SELECT
         CONCAT('[',
              GROUP_CONCAT(
                   CONCAT('{"id":"',STRUCTURE_ID,'"'),',',
                   CONCAT('"pId":"',parent_id,'"'),
                   CONCAT(',"name":"',STRUCTURE_NAME),'"',
                   CONCAT(',"structure_code":"',structure_code),'"}')

,']')
    AS json FROM t_resource_structure where STRUCTURE_ID BETWEEN 1110 and 1111

 

posted @ 2014-06-10 13:25  糖豆爸爸  阅读(9742)  评论(0编辑  收藏  举报
Live2D