我有以下數據的數據庫表:MySQL的選擇不同沒有得到所需的查詢結果
+--------------------+-----------------------------+
| order_no | part |
+--------------------+-----------------------------+
| AAAAAAAAAAAAA | QQQQQQQQ-WWW |
| AAAAAAAAAAAAA | EEEEEEEE-TTT |
| BBBBBBBBBBBBB | 33333333-333 |
| BBBBBBBBBBBBB | 44444444-444 |
| BBBBBBBBBBBBB | EEEEEEEE-TTT |
+--------------------+-----------------------------+
我的問題是,我無法作出查詢,以產生這樣的結果:
+----------------+-------------------------------------------+
| order_no | part |
+----------------+-------------------------------------------+
| AAAAAAAAAAAAA | QQQQQQQQ-WWW, EEEEEEEE-TTT |
| BBBBBBBBBBBBB | 33333333-333, 44444444-444, EEEEEEEE-TTT |
+----------------+-------------------------------------------+
提前致謝。
您正在尋找http://dev.mysql.com/doc/refman/5.7 /en/group-by-functions.html#function_group-concat – phobia82