Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Union Query with 7 queries (2003)

    Is it possible to do a union query with 7 queries. The seven queries are crosstabs. Each of the queries look like the example I have attached. I want to combine them so they appear like the 2 sample queries I have attached.
    Attached Files Attached Files
    • File Type: doc a.doc (27.0 KB, 8 views)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Union Query with 7 queries (2003)

    Why don't you try it?

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Union Query with 7 queries (2003)

    This works for two:
    SELECT DavisName,[Total of TotalDavisMem],[One Product],[Two or more products]
    from a_Davis_Crosstab
    Union Select HlHName,[Total Of TotalHlthMem],[One Product],[two or more products]
    from a_Health_Crosstab;

    How do I append the other 5 queries? do I just do Union Select for the others?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Union Query with 7 queries (2003)

    Yes. Remove the semi-colon ; at the end of the SQL statement and simply add more UNION SELECT ... parts.

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Union Query with 7 queries (2003)

    Thanks Hans for your help.

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Union Query with 7 queries (2003)

    For your information.

    Back in the Access 97 days i had a task to query 84 tables. I found the limit of 49 as the maximum number of Select statements in a union query.

    I don't know if this maximum has changed over the years.

Posting Permissions

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