Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 29th, 2006, 05:09 PM
Registered User
Join Date: Sep 2005
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default questions on crosstab queries


I need to get a result with crosstab query. The problem described as below:

Product Company Orders
A C1 4
B C2 6
C C1 10
D C1 2
E C2 5
F C1 7
G C1 8

I need to get the total numbers of orders group by some Product for each company C1 and C2, listed as below:
Product C1 C2
A-C 4+10 6
D 1 2
E-G 7+8 5

Is there a way to implement?

Thanks a lot for your kind help!
Reply With Quote
  #2 (permalink)  
Old April 3rd, 2006, 06:42 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

Can you give me more info on the data? You can do it but may have to do part of it with one query, and then total it with a second, or you may have to code some query results, etc.


Reply With Quote
  #3 (permalink)  
Old April 3rd, 2006, 05:11 PM
Registered User
Join Date: Apr 2006
Location: St. Paul, MN, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

What if you create a new table with a field called "group" and field called product? For each product you would have a group identified. Using your example, Group 1 would include products A,B,C. Group 2 would include product D. Group 3 would include D,E, and F.

Grp Product
1 A
1 B
1 C
2 D
3 E
3 F
3 G

Product could be a primary key. Name the groups anyway you wish, I used 1,2,3 for the sake of brevity.

Relate product in the table above to the product in the table you showed. This should help with the grouping problem.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
crosstab yula Crystal Reports 1 August 31st, 2006 11:27 AM
Combining Queries or results from 2 queries Ford SQL Server 2000 24 November 7th, 2005 08:54 PM
Does Replication Kill Crosstab Queries? markw707 Access 1 February 16th, 2005 09:21 PM
crosstab s_a_ravi BOOK: Professional Crystal Reports for VS.NET 0 January 21st, 2005 01:14 AM
Best way of running crosstab queries lucky Classic ASP Databases 0 August 5th, 2003 09:36 AM

All times are GMT -4. The time now is 12:53 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.