For best performance refer to this url
http://sqlperformance.com/2012/07/t-sql-queries/running-totals