- Group_concat usage group_concat ([DISTINCT] field to connect [order by Asc/desc sort field] [Separator ' delimiter '])
- SELECT Column1, Group_concat (Ifnull (column2,0), ', ', Ifnull (column3,0), ', ', Ifnull (column4,0) ORDER by LENGTH (Colu MN5), COLUMN4) column_name from table_name
- A multicolumn link is a row, and the columns and columns are separated by commas. Each row is then linked to a full result row cluum_name, and each line is separated by a comma.
- The contents of the column cannot be null, need to be ifnull converted, otherwise the result of the link is null
- column_name The default allowable length is 1024
- Modify the length of the Group_concat_max_len because the results that are larger than 1024,group_concat are truncated.
- Set global group_concat_max_len=102400;//, restart SQL function
- Set SESSION group_concat_max_len=102400;//reply setting, then it worked.
- I use the second method set SESSION group_concat_max_len=102400.
- The results were found to be normal, but after exporting Excel (2003) The results of Group_concat were still truncated.
MySQL function group_concat the longest string in cell and Excel export issue