View Full Version : SQL - join three fields - same table into one column


mackyrm
07-07-2008, 12:48 AM
I'm trying to create a query that lists all telephone numbers in one column. I have three telephone fields in one table and would essentially like to take these three fields and Chang and together on one list.
I have tried the union command but without success; I'm assuming this command is only used to join separate tables and not fields within the same table.

Much appreciated

Macky

antoka05
07-07-2008, 12:52 AM
Try with:

Select <field 1> from <table> as <Alias>
UNION Select <field 2> from <table>
UNION Select <field 3> from <table>

Regards,
Antonio

mackyrm
07-07-2008, 01:06 AM
Doesn't seem to work, I should be getting 25823 records, but only getting 25093...

antoka05
07-07-2008, 01:07 AM
UNION command automatically delete duplicated records.
If you want all records use 'UNION ALL' and not 'UNION'.

Regards,
Antonio

mackyrm
07-07-2008, 01:55 AM
Perfect. That saves me the effort of the next step in the process of cleaning and preparing the list!

Many thanks!