Fri, 17 May 2024


How to join results with UNION in MySQL?

By: Anton, NetArt Media
Tue, 29 March 2022
How to join results with UNION in MySQL?

The UNIONs were introduced in MySQL 4. The unions are useful if you wish to join the results from more than one query, but be aware that the number of the returned columns by each select query should be the same. (as well as their type)

The very simple example below show you the basics of the UNION statement

SELECT id, name FROM my_table
UNION
SELECT id, name FROM my_table;


Category: Databases
Share this post:



See All Scripts






Subscribe for our newsletter

Receive the latest blog posts direct in your mailbox