Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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

Hi,

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!
  #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
Default

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.

HTH

mmcdonal
  #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
Default

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.


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





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