Union Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is a union query? When should it be used and when should it not be used?

Thanks in advance for the help.
 
JV said:
What is a union query? When should it be used and when should it not be used?

A UNION query tacks the data records of one query onto the
data records of another query. E.g.if you have two tables:

table1:
nm v
--------
A 1
B 2

table 2
txt num
------------
X 3
Y 4

then the union query:

SELECT nm, v FROM table1
UNION
SELECT txt, num FROM table2

will return the data records:

nm v
--------
A 1
B 2
X 3
Y 4

UNION queries are rarely needed in a propery normalized
database.
 
Back
Top