Mysql 行数据转换为列数据

 

现有如下表:

 

 

需要统计手机所有售卖价格,显示为如下表:

需要使用group_concat对price进行处理,并且去重重复价格

sql如下:

select type,group_concat(DISTINCT(price) Separator ",") as price from table

 

posted @ 2019-05-17 20:54  Johnson_wang  阅读(3190)  评论(0编辑  收藏  举报