Hi,
Suppose, Database table has two column AMOUNT and DATE and also two rows. I want to get subtraction from first row to second row values of AMOUNT. What will be SQL Statement for this? Plz,help me.
Thanks.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pravin MorePosted Nov 22, 2011, 7:48 AM
Hi Alok ,
if your table have auto increment column for that table then here is one way to do it.......
select acc2.Amount-acc1.Amount from account acc1 (nolock)
inner join Account acc2 (nolock)
on acc1.AccountID=acc2.AccountID-1
Note:- i have considered here AccountID is autoincrement column by 1
Thanks,
Pravin.