2
我有一个包含事件列表的表格。我想基于唯一值“事件”将多行中的单位值连接到一列中以用于显示目的。将不同行中的值合并到一个图层中
当前数据:
Date Time Incident Unit
1/1 1200 1234 101
1/1 1200 1234 102
我想怎么显示出来:
Date Time Incident Unit
1/1 1200 1234 101, 102
我使用的MySQL/PHP。
谢谢!
['GROUP_CONCAT'](http://dev.mysql.com/doc/refman/5.0/en/group- by-functions.html#function_group-concat) – Wrikken
这里是一个很好的投资:http://stackoverflow.com/questions/276927/can-i-concatenate-multiple-mysql-rows-into-one-field?rq=1 ,也是http://stackoverflow.com/questions/12635714/php-mysql-joining-three-tables-and-merging-results?lq=1(这是一种情况下,我嫉妒我的愉快的SQL Server: - /) – user2246674