tags:

views:

42

answers:

4

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?

+1  A: 

Do you mean this?

select status, count(*)
from   employees
group by status

Or

select name, count(*)
from   employees
where status = 'Present'
group by name
JohnoBoy
if i have a name abc in database for that name how can i get the count
sumithra
just add to the `WHERE` clause your name, like `WHERE name = 'abc'`
balexandre
A: 

Select count(*) from employees where status="Present" group by name;

explorex
I have a name abc in my database. Everytime he checkins status l be set present. Now i need to get the count of status only for abc.
sumithra
select count(name), name from employees where status='Present' and name='abc';
explorex
A: 

select count(1) from employees where status='Present' group by name

A: 

Try this:

select name, count(*)
  from employees
  where name = 'abc' and
        status = 'Present';

Share and enjoy.

Bob Jarvis