I have a table like this:
CREATE TABLE tbltest (
Col1 Integer(10) UNSIGNED,
Col2 Integer(10) UNSIGNED
)
An there is the sample values:
Col1 Col2
---------
1 1
2 1
3 1
4 1
5 1
6 2
7 2
8 2
9 2
10 2
11 1
12 1
13 1
14 1
15 1
I want to SELECT
SUM(col1)
GROUPBY
sequence values of col2 not by all values. With above data results is like this:
col1 col2
---------
15 1
40 2
75 1
I don't have any idea how the query is looks like. Also forgive me for this bad title. I don't know what it should be called.
Thanks