8

There is a status column. I need to pull all the distinct values for each one, and a number indicating how many times each unique value is in the table.

Is there a way to do that?

Thanks.

2 Answers 2

17
SELECT status, count(*) as c FROM table GROUP By status;
Sign up to request clarification or add additional context in comments.

Comments

0

I am not sure I understand what you are after.

When you pull distinct values, there is (by definition) one of each unique value.

Can you rephrase what you are trying to do?

UPDATE

After reading another solution, I think I see what you are after.

Using SELECT COUNT(*) as given in the solution by Rufinus should do the trick.

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.