group_concat(),手冊上說明:該函數返回帶有來自一個組的連接的非NULL值的字符串結果。
通俗點理解,其實是這樣的:group_concat()會計算哪些行屬於同一組,將屬於同一組的列顯示出來。要返回哪些列,由函
數參數(就是字段名)決定。分組必須有個標準,就是根據group by指定的列進行分組。
select aid,group_concat(bid order by bid separator ',') as bid_str from tbl group by aid;
SET GLOBAL group_concat_max_len = 1024;
show variables like "group_concat_max_len";