I have a table answers
in a PostgreSQL engine powered database, with a number associated to a question. I need to count how many numbers are there and how many of them are below 6 grouped by question.
What I want is something like:
SELECT question, count(*) AS Qanswers, count_below_6(*) AS Qanswers_below_6
FROM answers
GROUP BY question;
question | Qanswers | Qanswers_below_6
-----------------------+----------+------------------
How do you feel? | 1234 | 53
Was clear the webinar? | 8444 | 20
How much that hurt? | 3666 | 142
Currently I'm doing
SELECT question, count(*) AS Qanswers
FROM answers
GROUP BY question;
And then
SELECT question, count(*) AS Qanswers
FROM answers
WHERE value < 6
GROUP BY question;
After that I merge the two results manually.
Can I make a single sentence that gives me the result as I need?