Totals query grouped across columns

buratti

Registered User.
Local time
Today, 02:49
Joined
Jul 8, 2009
Messages
234
I have a simple question but its hard to explain exactly what I mean. Ill give it a try... I have simple table data structured as follows;
[Origin],
Code:
, [Weight]. The Code field is a lookup field that will contain one of 8 choices; 10, 13, 13c, 23, 25, 27, 27a, & other. The other fields are pretty much self explanatory. 
Sample data would look like this:

[CODE]
 Origin        Code       Weight
Edison        13          4.25
Edison        13c         2.87
Piscataway  10          5.45
Middlesex    23         1.24
Edison        13          5.21
What I need to create is a totals query where I first group by origin value, then a column for each "code" value which totals the weight for that "code"

A sample output would look something like this:

Code:
 [U]Origin              10      13      13c     23     25     27     27a     other[/U]
Edison                      9.46    2.87
Piscataway     5.45
Middlesex                                    1.24
The only way I can think to accomplish this is to restructure the original table to include a field for each code and enter the weight in the appropriate 'code' field. If this is the only solution then Ill have to live with it, but is there any way to create this output using my original structure?
 
Create a cross tab query, use the wizard.
 

Users who are viewing this thread

Back
Top Bottom