Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 27th, 2004, 02:35 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.

Reply With Quote
  #2 (permalink)  
Old October 27th, 2004, 03:45 PM
Friend of Wrox
 
Join Date: Jan 2004
Location: , , USA.
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #3 (permalink)  
Old October 27th, 2004, 04:01 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Perfect! Thanks for the help.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding COUNTs fizzerchris SQL Server 2005 3 February 6th, 2007 05:16 PM
Join for two different counts on same view thenoseknows SQL Server 2000 0 January 21st, 2007 06:37 PM
join two counts field erin SQL Language 2 October 29th, 2003 04:50 AM
How to HavePrint Counts amar Pro VB 6 0 July 13th, 2003 10:05 AM
Get Counts harpua Classic ASP Databases 3 June 10th, 2003 12:45 AM



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


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