Hi Justine,
The problem is not very clear; do you want to find the sum of all amounts for key_fields 1 and 2 ?
SQL> desc t3
Name Null? Type
--------------------------- -------- ------------------
AMOUNT NUMBER
KEY_FIELD NUMBER
SQL> select * from t3;
AMOUNT KEY_FIELD
---------- ----------
8000 1
25000 1
1800 2
2500 2
8996 2
SQL> select key_field, sum(amount) "Sum of Amounts"
2 from t3
3 group by key_field;
KEY_FIELD Sum of Amounts
---------- --------------
1 33000
2 13296
SQL>
Cheers,
Prat
|