mysql 将多条数据同一个字段拼接成字符串
未拼接前
select id from jsh_app where tenant_id=71 and ifnull(delete_Flag,'0') !='1'
id |
---|
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
拼接后
select CONCAT('[',(select GROUP_CONCAT(id separator '][')
from jsh_app where tenant_id=71 and ifnull(delete_Flag,'0') !='1'),']') ;
id |
---|
[72][73][74][75][76][77][78][79][80] |