If I have a table containing a column of text and a column of integers, how can I sum the integers specific to each text entry? Example:
text1 | 4
text2 | 2
text3 | 5
text2 | 3
text1 | 2
I want to do:
SELECT Text,SUM(Number)
FROM TABLE
However, that sums all the numbers together (text1 | 16). How can I sum the numbers with each text entry independently?(
text1 | 6
text2 | 5
text3 | 5 )
Have a look at the
GROUP BYclause: http://www.sqlite.org/lang_select.html#resultsetExample usage: