-
join 2 fields ascending
I am a total newbie. I have 2 queries with name, address and phone fields. I want to take only the phone numbers and join them together without duplicates.
Thanks for your help
-
Do you mean that you have 2 tables, ecah witha phone number field? And you want to create a single list of phone numbers from each table?
If so, you need to use a UNION query. Unfortunately you cannot design a UNION query in the query designer - you have to hand code the SQL in the SQL pane of a new query.
Here is an example:
SELECT [table1].PhoneNumber
FROM table1
UNION SELECT [table2].PhoneNumber
FROM table2
ORDER BY PhoneNumber
For a UNION query to work the fields in each table must have the same name and be the same data type. If the field names are different you can use the AS clause as follows:
SELECT [table1].HomePhone As Phone
FROM table1
UNION SELECT [table2].MobilePhone As Phone
FROM table2
ORDER BY Phone
I hope this is what you're looking for, if not post some more details...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|