Szűcs,
Thanks for your suggestion, I
guess there is more than one way to attack the problem.
I ended up using a trick with limit to get the next
row ...
select (b.gc_minor- a.gc_minor), (b.gc_major-
a.gc_major)from jam_trace_sys a join jam_trace_sys b on(b.seq_no =
(select c.seq_no
Dear Virag,
AFAIK aggregates aren't indexed in postgres (at least not before 8.1, which
indexes min and max, iirc).
Also, I don't think you need to exactly determine the trace_id. Try this one
(OTOH; might be wrong):
select DISTINCT ON (a.trace_id, a.seq_no) -- See below
b.gc_minor
I have a table which stores cumulative valuesI
would like to display/chart the deltas between successive data
collections
If my primary key only increments by 1, I could
write a simple query
select b.gc_minor - a.gc_minor, b.gc_major -
a.gc_major from jam_trace_sys a, jam_trace_sys b wh