SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Distinct count for ticket count
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

masterdineen
Aged Yak Warrior

United Kingdom
548 Posts

Posted - 03/07/2013 :  10:16:10  Show Profile  Reply with Quote
Hello there.

Have a table with

customer_Id, gameName,

I want to select a distinct count for each game name,

at the moment I have have the following that will give me a total count for each game name.
But how do I count distinct customer id for each game name.

select game_name, COUNT (customer_id) from dbo.games

group by game_name

Regards

Rob

masterdineen
Aged Yak Warrior

United Kingdom
548 Posts

Posted - 03/07/2013 :  10:18:29  Show Profile  Reply with Quote
sorted

select game_name, COUNT (distinct customer_id) from dbo.games

group by game_name
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000