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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Count Function 1

Status
Not open for further replies.

egstatus

Programmer
Apr 14, 2005
143
US
Hi all,
I have a table that looks as shown below, I would like to return the count for the MMYY field. For example I would like the query to return count of 2 records for 0105, count of 3 records for 0205, count of 2 records for 0305 and so forth. When I use the count function it returns the total number of records for the MMYY field. I also tried the DISTINCT function, but that did not offer any help either. I know this is possible, I just can't figure it out.

Thanks in advance

Ed.


FName Lname MMYY CDN
Ed RIU 0105 15
ED RYE 0105 15
JOYCE MI 0205 15
PAT JONES 0205 15
ALAN PATEL 0205 15
ARPITA DOE 0305 15
KERRY KOUSMA 0305 15

 
Did you GROUP BY MMYY?
Please post the code in your query.


Randy
 
SELECT MMYY, Count(*) AS CountOfRecords
FROM yourTable
GROUP BY MMYY

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks Randy, That did it. I did not have the group by clause.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top