• One line statement:-

    SELECT ID,TransactionDate,Balance,CASE WHEN id<5 THEN 0 ELSE(select SUM(balance) FROM Accounts where ID between acc.id-4 and acc.id) end as RunningTotal from Accounts acc

    The Network rtraffic would be lesser, as per below statistics:-

    Network Statistics

    Number of server roundtrips11.0000

    TDS packets sent from client11.0000

    TDS packets received from server11.0000

    Bytes sent from client378378.0000

    Bytes received from server771771.0000