Home > Database > Mysql Tutorial > How to merge two tables in mysql

How to merge two tables in mysql

coldplay.xixi
Release: 2020-09-28 10:45:35
Original
20100 people have browsed it

Mysql method of merging two tables: first confirm that the fields of the two tables must be the same, and the book order must be consistent; then write SQL directly and use UNION ALL to connect them.

How to merge two tables in mysql

Mysql method of merging two tables:

1. There is a condition before merging the result set. The fields in the two tables must be the same, and the book order must be consistent.

As shown in the picture: the first table: zp_201707

How to merge two tables in mysql

2, the second table: zp_201708. The fields and order of these two tables are consistent

How to merge two tables in mysql

3. We write SQL directly and connect them with UNION ALL, and the results will come out!

How to merge two tables in mysql

4. The same is true when we add conditional query, it is very simple

How to merge two tables in mysql

More related free learning recommendations: mysql tutorial(Video)

The above is the detailed content of How to merge two tables in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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