calculation between current and previous line

N

Nevio

Hi,
I've a report in wich each line has a date; I have to
calculate the time difference between the previous line
and the current and put it on the current line.
Anyone has an idea on how can I manage to do that?
Many thanks in advance.
 
D

Duane Hookom

You can do this in your query by using a subquery.
SELECT MyTime, MyTime - (SELECT Max(MyTime) FROM tblA A WHERE
A.MyTime<tblA.MyTime) as TimeDiff
FROM tblA;
 

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