目前,为每一行显示行分组所依据的列。我只想在分组更改时显示该列。
例如:
water sea
ocean
river
sand beach
desert
trees woods
forest发布于 2016-04-27 23:46:09
如果您必须在MySQL中执行此操作,以下是您可以执行的操作:
select your_column1, group_concat(distinct your_column2 separator '\n') from your_table
group by your_column1;从…
your_column1 | your_column2
----------------------------
water | sea
----------------------------
water | ocean
----------------------------
water | river
----------------------------
sand | beach
----------------------------
sand | desert
----------------------------
trees | woods
----------------------------
trees | forest至
your_column1 | your_column2
----------------------------
water | sea
| ocean
| river
----------------------------
sand | beach
| desert
----------------------------
trees | woods
| foresthttps://stackoverflow.com/questions/36893122
复制相似问题