group by user that has answered all questions
I have a table of scores per userID
. The value of score
can be a number or null.
I would like a query that gets all use ids that have answered all 20 questions, i.e no nulls for that user.
I would really appreciate some help.
Use GROUP BY
, HAVING
, and COUNT
As this is probably homework I'll try the spoiler markup (mouse over to see the answer!)
select userID from yourtable group by userID having count(score)=20
Try something similar to:
select userID from ... group by userID having count(*)=20
精彩评论