MySQL function group_concat the longest string in cell and Excel export issue

Source: Internet
Author: User
Tags truncated

  • 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.
    • Helpless under the mSQL can only be found in the Results table Copy column, and then paste into the Excel column inside
    • EXCEL2003 the maximum number of columns is 256 columns (iv columns) the maximum number of rows is 65536 rows, and the maximum column count of EXCEL2007 or more is 16384 columns with a maximum number of rows of 1048576 rows.

MySQL function group_concat the longest string in cell and Excel export issue

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.