A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Union Query with two crosstabs



 
 
Thread Tools Display Modes
  #1  
Old May 25th, 2010, 05:29 PM posted to microsoft.public.access.queries
AccessKay
external usenet poster
 
Posts: 106
Default Union Query with two crosstabs

Hi…I attempted to do a Union Query with two crosstabs. I received an error
“Characters found after end of SQL statement. I then read some posts but
couldn’t find the solution. It appears that it is possible and I read
something about not having two TRANSFORM statements but it wasn’t clear to
me. I have the same number of fields and defined the PIVOT part by IN(“x”,
“y”, “z”) and used UNION ALL. What else do I need to do to join the two
crosstabs?

Thanks for any suggestions.

  #2  
Old May 25th, 2010, 05:41 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Union Query with two crosstabs

Do you have a semi-colon after the first query? If so that can cause the error?

If the two crosstabs are identical in the columns they output (same order),
you might be able to use

SELECT *
FROM Crosstab1
UNION ALL
SELECT *
FROM Crosstab2

It always helps us diagnose problems if you post the SQL statement of the
query that isn't doing what you want.



John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

AccessKay wrote:
Hi…I attempted to do a Union Query with two crosstabs. I received an error
“Characters found after end of SQL statement. I then read some posts but
couldn’t find the solution. It appears that it is possible and I read
something about not having two TRANSFORM statements but it wasn’t clear to
me. I have the same number of fields and defined the PIVOT part by IN(“x”,
“y”, “z”) and used UNION ALL. What else do I need to do to join the two
crosstabs?

Thanks for any suggestions.

  #3  
Old May 25th, 2010, 07:19 PM posted to microsoft.public.access.queries
AccessKay
external usenet poster
 
Posts: 106
Default Union Query with two crosstabs

Good Answer!!! That worked perfectly. Thank you, thank you, thank you....


"John Spencer" wrote:

Do you have a semi-colon after the first query? If so that can cause the error?

If the two crosstabs are identical in the columns they output (same order),
you might be able to use

SELECT *
FROM Crosstab1
UNION ALL
SELECT *
FROM Crosstab2

It always helps us diagnose problems if you post the SQL statement of the
query that isn't doing what you want.



John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

AccessKay wrote:
Hi…I attempted to do a Union Query with two crosstabs. I received an error
“Characters found after end of SQL statement. I then read some posts but
couldn’t find the solution. It appears that it is possible and I read
something about not having two TRANSFORM statements but it wasn’t clear to
me. I have the same number of fields and defined the PIVOT part by IN(“x”,
“y”, “z”) and used UNION ALL. What else do I need to do to join the two
crosstabs?

Thanks for any suggestions.

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:21 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 OfficeFrustration.
The comments are property of their posters.