Home > Database > Mysql Tutorial > body text

What are the points to note when using union in mysql?

王林
Release: 2023-06-03 20:04:01
forward
1744 people have browsed it

1. The union operator is used to combine the results of two or more select statements into a result set. Multiple select statements will delete duplicate data.

2. When using union to merge result sets, the number of columns in the two result sets is required to be the same.

Example

select playerno, town
from PLAYERS
where town = 'Inglewood'
union
select playerno, town
from PLAYERS
where town = 'Plymouth';
Copy after login

The above is the detailed content of What are the points to note when using union in mysql?. For more information, please follow other related articles on the PHP Chinese website!

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