Relative Content

Tag Archive for sqlt-sqlcommon-table-expression

How to query for an amount when it changes values base on a record (account#)

I am trying to query for an amount when it changes base on a record. For example the below table below.
I want to query for the rows with a (****). I want to know whenever the balance changes for each acct. Once i have that i want to show the difference from the latest balance to the previous balance change… so for acct 123456 i want to query for when balance change from 1000 to 2000 and show the difference in another query does not need to be all in one query. Hope i am making sense any help is appreciated.