Totals query rework

C

carmen

I have the following query that needs to be reworked. I have combined the
severity fields into one. The data that is stored in the fileld is S1,S2,S3
or null. How can I rework the query below to produce the same results

Thanks
Carmen

SELECT Format([closeddate],' mmmm yyyy') AS [Month], Count(calls.Severity1)
AS CountOfSeverity1, Count(calls.Severity2) AS CountOfSeverity2,
Count(calls.Severity3) AS CountOfSeverity3,
Sum(IIf(calls.Calltyp="Question",1,0)) AS Question,
Sum(IIf(calls.Calltyp="Other",1,0)) AS Other, Count(Format([closeddate],'
mmmm')) AS total
FROM calls
WHERE (((calls.ClosedDate) Is Not Null))
GROUP BY Format([closeddate],' mmmm yyyy'), Month([closeddate])
ORDER BY Month([closeddate]);
 
G

Gary Walter

Hi Carmen,

It sounds like you used to have 3 fields for Severity
but now you have one field ("Severity"?) that you
would like to "count" each instance of S1, or S2, or S3?

.....
Abs(Sum(calls.Severity = 'S1')) As CountOfSeverity1,
Abs(Sum(calls.Severity = 'S2')) As CountOfSeverity2,
Abs(Sum(calls.Severity = 'S3')) As CountOfSeverity3,
.....

Please respond back if I have misunderstood.

Good luck,

Gary Walter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Last Question on Select Query 3
Union query error 3
Another Question about Select Queries 5
Running sum expression 2
Crosstab Query help 2
Select Query 4
Query on Duration 1
Cross-Tab Query 2

Top