id mem_id tran_date tran_type tran_points plus_minus
-----------------------------------------------------------
1 2 2011-10-19 test 50 +
2 2 2011-10-19 test 50 +
3 3 2011-10-19 test 50 +
4 2 2011-10-19 test 15 -
For every individual member all the values in tran_points needs to be added when data in plus_minus column = ‘+’ and the sum of value in tran_points needs to be substracted when data in plus_minus = ‘-‘
I want to have the following output :
member_id points_balance
--------------------------
2 85
3 50
For the table below:
and for the entries below:
This query works as you expected: