Reputation: 1
I need to display the count of present status for a particular name
Select count(*) from employees where status='Present';
This query returns me entire present count. What should I do to get status for a particular name?
Upvotes: 0
Views: 394
Reputation: 50017
Try this:
select name, count(*)
from employees
where name = 'abc' and
status = 'Present';
Share and enjoy.
Upvotes: 0
Reputation: 1
select count(1) from employees where status='Present' group by name
Upvotes: -1
Reputation: 565
Do you mean this?
select status, count(*)
from employees
group by status
Or
select name, count(*)
from employees
where status = 'Present'
group by name
Upvotes: 2