Subject | Simple sql query question |
---|---|
Author | jasajona |
Post date | 2004-11-05T10:55:21Z |
Hello,
I am wondering is it possible to get this result without writting UDF.
There is a table:
Field1 Field2
---------------
1 2
1 1
1 3
2 4
2 1
2 3
---------------
I need to get in one recod sum() of Field2 according to Field1. Wanted
result:
ResField1 ResField2
---------------------
6 8
---------------------
6 = 2+1+3 (Field1 = 1)
8 = 4+1+3 (Field2 = 2)
I am wondering is it possible to get this result without writting UDF.
There is a table:
Field1 Field2
---------------
1 2
1 1
1 3
2 4
2 1
2 3
---------------
I need to get in one recod sum() of Field2 according to Field1. Wanted
result:
ResField1 ResField2
---------------------
6 8
---------------------
6 = 2+1+3 (Field1 = 1)
8 = 4+1+3 (Field2 = 2)