F
F
fessracha2020-09-14 13:15:18
SQL
fessracha, 2020-09-14 13:15:18

How to implement counting the number of elements with a specific SQL value?

I have the following table 5f5f175121a9c268860601.png
. For each element, I need to display its count with the active status.
I tried to implement this using this query: SELECT name, COUNT(status='active') FROM docs GROUP BY name
but in this case all fields are considered. 5f5f4279bf12b513451583.png
Please tell me what is wrong and how to fix it

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman, 2020-09-14
@fessracha

SUM(status='active')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question