Counting two fields from a query, using a query (1 Viewer)

joseph.larrew

Registered User.
Local time
Today, 11:09
Joined
Oct 26, 2010
Messages
13
First off, I'm using 2 queries, LAME ASS (which stands for "Longterm Average MEdia ASSessment) and SUB LAME ASS. Here is the code for both:

SUB LAME ASS:
SELECT EXSUMs.[IPA/West], EXSUMs.LOO.Value, EXSUMs.Tone, EXSUMs.[EXSUM Date], EXSUMs.[EXSUM Body]
FROM EXSUMs
WHERE EXSUMs.[IPA/West] = [Enter '1' for IPA/'2' for Western] AND EXSUMs.[EXSUM Date] BETWEEN [Enter Begin Date] AND [Enter End Date];

LAME ASS:
SELECT EXSUMS.LOO.Value, COUNT (EXSUMs.LOO.Value) AS [Number of EXSUMS by LOO]
FROM [SUB LAME ASS]
GROUP BY EXSUMs.LOO.Value;

The results when I run the LAME ASS query resemble the following:
LOO.Value..........Number of EXSUMs by LOO
Security ............x
Political .............y
Rule of Law ........z
so on and so on...

So as you can see, I'm successfully counting and grouping by LOO.Value. Now what I want to do is count the tone and sub-group the count of the tone under each LOO.Value.

I'd like to make something that looks like this:
LOO.Value ......Tone.........Number of EXSUMs
Security..........Positive ....x
.....................Negative....y
.....................Neutral .....z
.....................Total1 ......x+y+z
Political ..........Positive ....a
.....................Negative ...b
.....................Neutral .....c
.....................Total2 ......a+b+c
.....................Total3 ......(x+y+z+a+b+c) or (Total1+Total2)

To me, it seems like maybe I need to make one or two more nested queries, but I'm not sure how to go about it. Any help would be greatly appreciated.
 
Last edited:

joseph.larrew

Registered User.
Local time
Today, 11:09
Joined
Oct 26, 2010
Messages
13
Oh, and I believe that in order to do my Total1-3, it may be possible just to do a totals row that Access 2007 uses.
 

joseph.larrew

Registered User.
Local time
Today, 11:09
Joined
Oct 26, 2010
Messages
13
Wow, I just figured that it is as easy as selecting the LOO field, then the Tone field, then just one COUNT operation, then group it by LOO, then Tone. Simple.
 

Users who are viewing this thread

Top Bottom