0

I Have a table like this and I would like to get the number of distinct value for these 3 column (string_2 string_2 and string_3)

I know how to do a distinct and count in mysql, but in this case, I dont know how to count different distinct value for multiple column

enter image description here

The input I would like to have is

enter image description here

1 Answer 1

2

You need to use a combination of count and distinct:

SELECT 
    count(distinct string_1) AS string_1, 
    count(distinct string_2) AS string_2, 
    count(distinct string_3) AS string_3 
FROM table_name 
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.