HOWTO: diffs between rows.

2002-05-21 Thread David Shields
Probably a very simple one for you guys, but I'm stuck. Given a simple table (events): id int st time not null et time not null I know I can get duration by converting st and et to secs and subtracting (that bits easy), but how would I go about getting the gap between successive

Re: HOWTO: diffs between rows.

2002-05-21 Thread Rob
You could join the table against itself, matching each row against every following record and then summarizing to find the next one. If your table is of a fair size, you'd need to play with the optimizer to make sure you get the efficiency you need. The SQL would be along the lines of: select

Re: HOWTO: diffs between rows.

2002-05-21 Thread Thomas Spahni
On Tue, 21 May 2002, David Shields wrote: Probably a very simple one for you guys, but I'm stuck. Given a simple table (events): idint sttime not null ettime not null I know I can get duration by converting st and et to secs and subtracting (that bits easy), but how would I