Difference of each row from the next row of one table

S

SMB

Dear All,

Suppose I have a table with the following data

Date Rate

01-01-07 255
01-02-07 250
01-03-07 260
01-04-07 255

I want to write a query which calculates the rate difference in each row and
the output should be like this

Date Rate Difference

01-02-07 250 -5
01-03-07 260 10
01-04-07 255 -5

It means that the difference of rate in current date from the rate in
previous date should be the third column.

WHAT THE QUERY SHOULD BE ???????

Please write the select statement.

Thanks
 
S

SMB

Dear Allen Browne,

Thank you very much. I got the solution of my problum.

I will study your web site later on to get more tips.

Thanks again.
Shaukat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top