On Sun, Oct 21, 2012 at 2:30 AM, Berend Tober <btober@xxxxxxxxxxxxxxx> wrote: > What about if there is more than one column you want the difference for (... > coincidentally I am writing a article on this topic right now! ...), say a > table which is used to record a metered quantity at not-quite regular > intervals: > ... > > I am working on a write-up of a neat solution using CTE's, but would be > interested in other's views. To be quite honest, I would simply read the table directly and then do the processing in an application language :) But two window functions should do the trick. Whether or not it's actually more efficient that way is another question. ChrisA -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general