Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get a count of records returned. 1

Status
Not open for further replies.

bosk00

Technical User
Mar 5, 2004
91
0
0
US
We coach hearings for our clients. I have a simple database with entrys for each hearing. I have a query that starts with the contract month for our clients, and then brings back the hearings for each client within a time frame. What I really need is the total of hearings for each client, not the individual hearings.
Code:
SELECT Q.T01CONDTM, H.[Date of Hearing], H.Company
FROM QAMAIN Q INNER JOIN [Hearing Data] H ON Q.COMPANY = H.Company
WHERE (((Q.T01CONDTM)=[Enter Contract Month]) AND ((H.[Date of Hearing]) Between [Enter Beginning Date] And [Enter Ending Date]))
WITH OWNERACCESS OPTION;
I am unclear on how to add Count(). All help is appreciated.
Thank You

Alan
Senility at its finest
 
You may try this:
SELECT Q.T01CONDTM, H.Company, Count(*) As CountOfHearings
FROM QAMAIN Q INNER JOIN [Hearing Data] H ON Q.COMPANY = H.Company
WHERE (((Q.T01CONDTM)=[Enter Contract Month]) AND ((H.[Date of Hearing]) Between [Enter Beginning Date] And [Enter Ending Date]))
GROUP BY Q.T01CONDTM, H.Company;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank you very much. That did it.

Alan
Senility at its finest
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top