Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id BCC559FA334 for ; Fri, 15 Dec 2006 08:27:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 34099-08 for ; Fri, 15 Dec 2006 08:27:32 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.177]) by postgresql.org (Postfix) with ESMTP id 2216A9FA0FB for ; Fri, 15 Dec 2006 08:27:37 -0400 (AST) Received: by py-out-1112.google.com with SMTP id a73so415425pye for ; Fri, 15 Dec 2006 04:27:36 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=uVAmxNCVPrMRZ0Gr0ClXaaqK7AlhW5OWreBB4mSOMp6PSFxggJY+z+htVIdu0nztEtOht4C6gSJd49nux4lxNWyaPPtjfVpBPbVEAxE7bbPQSbjBzMm56AWzXkbbbmuMhRVSfgWVrKzAwQKb3e1JFTkRxfezWdksfnoRUXANCgo= Received: by 10.35.18.18 with SMTP id v18mr1371565pyi.1166185655939; Fri, 15 Dec 2006 04:27:35 -0800 (PST) Received: by 10.35.131.17 with HTTP; Fri, 15 Dec 2006 04:27:35 -0800 (PST) Message-ID: <6bdfe880612150427o19bfe90ch87a972c0f5898ffb@mail.gmail.com> Date: Fri, 15 Dec 2006 18:27:35 +0600 From: "Partha Guha Roy" To: pgsql-sql@postgresql.org Subject: Need to subtract values between previous and current row MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_125056_8950073.1166185655898" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/109 X-Sequence-Number: 27065 ------=_Part_125056_8950073.1166185655898 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I have a table that contains data like this: ID ATIME (MM/dd/yyyy) == ==== 1 10/12/2006 2 10/14/2006 3 10/18/2006 4 10/22/2006 5 10/30/2006 Now I need a query that will subtract atime of row 1 from row 2, row2 from row3 and so on... Can anyone please help? Regards. -- ------------------------------ Partha Guha Roy *********************************************** Take everything you like seriously, except yourselves. - Rudyard Kipling ------=_Part_125056_8950073.1166185655898 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi,

I have a table that contains data like this:

ID           ATIME (MM/dd/yyyy)
==          ====
1            10/12/2006
2            10/14/2006
3            10/18/2006
4            10/22/2006
5            10/30/2006

Now I need a query that will subtract atime of row 1 from row 2, row2 from row3  and so on...

Can anyone please help?

Regards.

--
------------------------------
Partha Guha Roy
***********************************************
Take everything you like seriously, except yourselves.
- Rudyard Kipling ------=_Part_125056_8950073.1166185655898--