Results 1 to 3 of 3
  1. #1
    dssrun is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    83

    Union Crosstab

    I have read some threads on how to union multiple crosstab tables, but it is giving me an error, saying "Missing operator" on the first cross tab query last line where my query says "Pivot...UNION ALL...(SQL of next crosstab)". I checked both crosstabs independently and they work. I need it run like this for a report. Both queries have the same columns. Any help will be appreciated



    Code:
    PARAMETERS xxxx DATETIME
    CROSSTAB QUERY
    
    UNION ALL
    
    CROSSTAB QUERY

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    There's probably a less kludgy way around it but what I do is save my crosstab queries in another query. and then do a union on those queries.

    So let's say you have qryCrosstab1 and qryCrosstab2 which are crosstab queries. I'd create 2 more queries qryVwCrosstab1 and qryVwCrosstab2 which are essentially "SELECT * FROM qryCrosstab1" and then do a union on the Vw queries:

    SELECT * FROM qryVwCrosstab1
    UNION
    SELECT * FROM qryVw Crosstab2

  3. #3
    dssrun is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Oct 2010
    Posts
    83
    Thanks for the idea. What I actually did was reverse my logic, I did all unions then crosstab the unions.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Union Query Help
    By pmp in forum Queries
    Replies: 4
    Last Post: 10-28-2011, 06:41 AM
  2. Union & union all
    By jasonbarnes in forum Queries
    Replies: 4
    Last Post: 10-27-2011, 12:30 PM
  3. Union or better way.
    By kevin28 in forum Access
    Replies: 2
    Last Post: 09-06-2011, 02:42 PM
  4. Union Query Help
    By jo15765 in forum Queries
    Replies: 7
    Last Post: 01-06-2011, 05:46 PM
  5. Need help with a Union Query
    By jdowdy in forum Access
    Replies: 1
    Last Post: 10-13-2009, 05:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums