You can do this using a running total. Take a look at this article that explains how to do a running total in sql.
http://www.sqlservercentral.com/articles/T-SQL/68467/[/url]
If you get stuck feel free to post back here. It is best if you can provide data in a consumable format. Since you are brand new around here I did this for you so you can see.
;with Data(ClassID, MemberID, Weight) as
(
select 'A', 1, 10 union all
select 'A', 2, 20 union all
select 'A', 3, 40 union all
select 'A', 5, 25 union all
select 'A', 6, 15 union all
select 'A', 8, 10 union all
select 'B', 1, 50 union all
select 'B', 2, 10 union all
select 'B', 3, 60 union all
select 'B', 6, 400
)
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/