Home  >  Article  >  Database  >  What are the points to note when using union in mysql?

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

王林
王林forward
2023-06-03 20:04:011707browse

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';

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!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete