mardi 23 février 2016

How can I reduce the amount of rows in a SQLite query?

I have two columns i want data from but when i use:

SELECT rank, points FROM game

I get everything like this:

Rank | Points

rank_1 | 10
rank_2 | 5
rank_3 | 20
rank_1 | 5
rank_1 | 6
rank_2 | 4

I can't figure out how to group all with the same rank into just one row and also group all the individuals points into one row. Like this:

Rank | Points

rank_1 | 21
rank_2 | 9
rank_3 | 20

So i can see which rank has the most points collectively.

Aucun commentaire:

Enregistrer un commentaire