Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    40

    Unanswered: Combining Results from Mulitple Queries

    I have a table that stores address information from multiple clients in different countries. A user wishes to print address labels from the database, but many countries have different addressing formats. I can isolate different formats by building a select query for each group of countries that conforms to a specific format, and creating an expression to concatenate into the correct format.

    Here enters the problem: how do I take the results from multiple queries and combine them into one? Each query will have unique records.

    I'm stumped. Any ideas?

  2. #2
    Join Date
    Jun 2004
    Posts
    92
    Quote Originally Posted by beersnob
    I have a table that stores address information from multiple clients in different countries. A user wishes to print address labels from the database, but many countries have different addressing formats. I can isolate different formats by building a select query for each group of countries that conforms to a specific format, and creating an expression to concatenate into the correct format.

    Here enters the problem: how do I take the results from multiple queries and combine them into one? Each query will have unique records.

    I'm stumped. Any ideas?
    Create a union query to combine them.

    Example:

    SELECT [License #],[State],[Color],[Make],Null
    FROM [table1]

    UNION SELECT [LicensePlate],Null,Null,Null,[Address]
    FROM [table2];

    It basically says, ok 1st column is the same for both queries, then the first select has the state, color, and make columns and you want to ignore them in the second select. The second select then has the address query, and you want the first one to ignore it.

    So you get a query results, with lic, state, color, make, and then a blank field from table1. Also results of lic, blank, blank, blank, address from table2.

    I think I explained it well enough. Lol.. If not, just look up union queries in the help pages.

  3. #3
    Join Date
    Apr 2004
    Posts
    40
    Thanks, sionus! The union query works like a charm. I suspected there was a simple solution.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •