0

How do you select distinct, and count of distinct? I have a table:

col1    col2
 1       1
 1       0
 0       0
 0       1
 1       1
 0       0

And I'm trying to get this:

col1    col2    count
 1       1        2
 1       0        1
 0       0        2
 0       1        1

1 Answer 1

1

You just need to use GROUP BY clause with multiple columns.

SELECT col1, col2, COUNT(*) FROM Table1
GROUP BY col1, col2
Sign up to request clarification or add additional context in comments.

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.