mardi 27 mars 2018

Using MySQL summing up one column by distinct group of the other two column values [duplicate]

This question already has an answer here:

I have a data set in the format: There are actually other columns like age, race, education... enter image description here

But right now, I need to sum the female and male population in each county. So the output will like enter image description here

I have achieved this by a very dummy version, but I think there must be a easier way to do this (either with group by or sum(if()), but i couldn't figure it out)

could someone please help me take a look? Thank you~

Aucun commentaire:

Enregistrer un commentaire