Sampling with grouping and sum?

0 like 0 dislike
7 views
Got a sketch request:
SELECT * FROM `stat` GROUP BY `geo` ORDER BY `good` DESC

It works correctly, I can not understand how you can group fields and understand at the same time to calculate the sum in this group.
That is, there are countries (geo) they have the conversion (good == 0 || 1) I need to output data like this example:
EN(`geo`) - 100(total number of `good` geo 'EN')
US - 50
GB - 30
by | 7 views

1 Answer

0 like 0 dislike
SELECT `geo`, sum(`good`) as `sum_good` FROM `stat` GROUP BY `geo` ORDER BY `sum_good` DESC


But this is not accurate)
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
asked May 20, 2019 by barrty
110,608 questions
257,186 answers
0 comments
33,768 users