zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

mysql中json数据的拼接方式

mysql数据JSONJSON 方式 拼接
2023-09-27 14:28:13 时间
    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