this question has answer here:
i have table of finishedgames columns: category , score. need know how many games category finished more score, don't understand count if structure in postgresql.
select category, count(score) rounds, count(if score > 7) wins "finishedgames" group category;
does knows how in postgresql?
you should use case
clause within count function. e.g. count(case when score > 7 1 else null end)
(or sum
1 , 0 - same result...)
regards, jony
Comments
Post a Comment