0

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
  • 1
    for the question you ask to all the comments in all answers, you should start to see some SQL tutorials, try this first: w3schools.com/sql/default.asp - Ahhh, and keep in mind that SQL is not Microsoft SQL, SQL is a database query language! Commented Sep 20, 2010 at 10:06

3 Answers 3

2

Do you mean this?

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

Or

select name, count(*)
from   employees
where status = 'Present'
group by name
Sign up to request clarification or add additional context in comments.

2 Comments

if i have a name abc in database for that name how can i get the count
just add to the WHERE clause your name, like WHERE name = 'abc'
0

Try this:

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

Share and enjoy.

Comments

-1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.