Home > Database > Mysql Tutorial > body text

mysql converts large amounts of data into arrays

王林
Release: 2020-01-28 21:08:32
forward
2438 people have browsed it

mysql converts large amounts of data into arrays

Requirements analysis:

As shown in the picture:

mysql converts large amounts of data into arrays

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)

mysql converts large amounts of data into arrays

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
Copy after login

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!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!