Home >Database >Mysql Tutorial >mysql converts large amounts of data into arrays
Requirements analysis:
As shown in the picture:
In the excel file shown above, each The corresponding advertising space under the field is presented in the form of an array as shown below:
(Free learning video tutorial recommended: mysql video tutorial)
Solution:
1. First, use the mysql client Navicat for MySQL to import excel files in batches and create tables;
2. Then use the mysq function GROUP_CONCAT. The specific method is as follows :
select 'country' ,country,GROUP_CONCAT(placementid) from 2019q2 group by country union all select 'year' ,year,GROUP_CONCAT(placementid) from 2019q2 group by year union all select 'quarter' ,quarter,GROUP_CONCAT(placementid) from 2019q2 group by quarter
Recommended related articles and tutorials: mysql tutorial
The above is the detailed content of mysql converts large amounts of data into arrays. For more information, please follow other related articles on the PHP Chinese website!