×
Home About Us Products Services News Free Scripts Contact
news php scripts and software

Databases example - How to join results with UNION in MySQL?


Databases - 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

 
<< Go back