Mark This Response as Answer -- Chandu http://www.dotnetfunda.com/images/dnfmvp.gif
Mark as Answer if its helpful to you Kumaraspcode2009@gmail.com
declare @FromDate datetime = '21-08-2015' , @ToDate datetime = '23-08-2015'SELECT [Date], Payment-Receipt, RunningTotal = Payment-Receipt + COALESCE( ( SELECT SUM(Payment-Receipt) FROM dbo.PaymentDet AS s WHERE s.Date < o.Date and Date between @FromDate and @ToDate), 0 ) ,(SELECT SUM(Payment-Receipt) FROM dbo.PaymentDet WHERE date<@FromDate) OldBalFROM dbo.PaymentDet AS oWHERE Date between @FromDate and @ToDateORDER BY [Date];
Login to post response