我在mysql数据库表中有以下两行
Chart_date chart_field chart_counts
20131115 user_jrFeed_item_count {"1":2}
20131115 user_jrForum_item_count {"1":1}
如何创建另一行以实现以下结果
Chart_date chart_field chart_counts
20131115 user_jrFeed_item_count,user_jrForum_item_count {"1":2},{"1":1}
OR
Chart_date chart_field chart_counts
20131115 new description {"1":2},{"1":1}
答案 0 :(得分:2)
SELECT Chart_date,GROUP_CONCAT(chart_field )as chart_field,
REPLACE(GROUP_CONCAT(chart_counts),'2},{','2,')as chart_counts
FROM table WHERE Chart_date='20131115' GROUP BY Chart_date