Kristopher Ives
Kristopher Ives

Reputation: 6035

Count total number of callers?

I'm currently doing this query to find the guy who makes the most calls:

SELECT 
    `commenter_name`, 
    COUNT(*) AS `calls` 
FROM `comments` 
GROUP BY `commenter_name` 
ORDER BY `calls` LIMIT 1

What I want now is to be able to find out how many total unique callers. I tried using DISTINCT but I didn't get anywhere.

Upvotes: 0

Views: 155

Answers (3)

user297621
user297621

Reputation:

Select Count(*) From (Select DISTINCT commenter_name from comment) as CmtCnt;

Upvotes: 0

Dan
Dan

Reputation: 548

SELECT COUNT(DISTINCT 'commenter_name') FROM 'comment';

Upvotes: 6

Andrey
Andrey

Reputation: 60085

SELECT DISTINCT `commenter_name` FROM `comments`

Upvotes: 0

Related Questions