problems with group by query...

B

Brad Pears

I am working on an an Access 2000 query to list the number of active cases
for each manager and am having some problems....

Here is a simplified version of the tables and some data...

Table: CustServ
Fields CaseNo, Manager
data...
CaseNo Manager
01 jsmith
02 jsmith
03 lgooden

Table: Issues
Fields Issueno, CaseNo, Closed
data...
IssueNo CaseNo Closed
01 01 False
02 01 False
03 01 True
04 02 False

What I want to list is a group by query by manager giving me just the
individual manager names and the sum of the total number of open issues
(closed = false) for each.

So using the above tables and data, I would want my query to generate data
as follows...

Manager Open Cases
jsmith 2
lgoodens 1

Can someone give me the sql to do this?
 
M

Marshall Barton

Brad said:
I am working on an an Access 2000 query to list the number of active cases
for each manager and am having some problems....

Here is a simplified version of the tables and some data...

Table: CustServ
Fields CaseNo, Manager
data...
CaseNo Manager
01 jsmith
02 jsmith
03 lgooden

Table: Issues
Fields Issueno, CaseNo, Closed
data...
IssueNo CaseNo Closed
01 01 False
02 01 False
03 01 True
04 02 False

What I want to list is a group by query by manager giving me just the
individual manager names and the sum of the total number of open issues
(closed = false) for each.

So using the above tables and data, I would want my query to generate data
as follows...

Manager Open Cases
jsmith 2
lgoodens 1


Try playing around with this:

SELECT CustServ.Manager, Count(*) As OpenCases
FROM CustServ LEFT JOIN Issues
ON CustServ.CaseNo = Issues.CaseNo
WHERE Issues.Closed = False
GROUP BY CustServ.Manager
 

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

Problems with Group By query 5
Receiving valid Multicast address failed on mini port driver 0
Me and Mid 3
Mid in query 5
Query question 2
Problem with error 53 2
dlookup help 2
SQL HELP 4

Top