p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   SQL Language (http://p2p.wrox.com/forumdisplay.php?f=100)
-   -   Getting Counts (http://p2p.wrox.com/showthread.php?t=20483)

hugh@kmcnetwork.com October 27th, 2004 02:35 PM

Getting Counts
 
Hello Everyone and thanks for your help in advance. I am having trouble with a query. I need to return one occurrence of an individual's name and ID number along with the count for the number of times this person appears in the table. I have tried a Group By clause, but to the best of my knowledge, would require the Group By part to have both NAME and ID in the grouping, which doesn't seem to return what I want. I have tried Select Distinct, but can't figure out how to get the count. Any help on this topic would be greatly appreciated. Thanks.


shahchi1 October 27th, 2004 03:45 PM

I apologize if I have not understand you question. Is this you are looking for..?

SELECT ID,Name,Count(Name) As Total
FROM Table
GROUP BY ID,Name

hugh@kmcnetwork.com October 27th, 2004 04:01 PM

Perfect! Thanks for the help.



All times are GMT -4. The time now is 08:34 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.