X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.225.181]) by svr1.postgresql.org (Postfix) with ESMTP id 73FABCC2D5 for ; Tue, 15 Jul 2003 12:09:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr5.postgresql.org [64.117.225.181]) (amavisd-new, port 10024) with ESMTP id 01979-05 for ; Tue, 15 Jul 2003 12:09:20 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by svr1.postgresql.org (Postfix) with ESMTP id F2BAACC328 for ; Tue, 15 Jul 2003 09:08:54 -0300 (ADT) Received: from [212.227.126.205] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 19cOcV-0005nI-00 for pgsql-sql@postgresql.org; Tue, 15 Jul 2003 14:09:23 +0200 Received: from [80.131.204.217] (helo=goofy.thiele-intern) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 19cOcU-00045R-00 for pgsql-sql@postgresql.org; Tue, 15 Jul 2003 14:09:23 +0200 Date: Tue, 15 Jul 2003 14:09:21 +0200 From: Erik Thiele To: pgsql-sql@postgresql.org Subject: summing tables Message-Id: <20030715140921.7c5a6a6c.erik@thiele-hydraulik.de> Organization: Thiele-Hydraulik X-Mailer: Sylpheed version 0.8.10 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/161 X-Sequence-Number: 14275 hi, i have a table consisting of 4 integers. seq is for making the table ordered. (ORDER BY SEQ ASC) a,b,c maybe null seq | a | b | c -----+----+----+--- 0 | 1 | 2 | 3 1 | 1 | 2 | 2 | 5 | 7 | 3 | -2 | -4 | i am needing a sql statement to do c=a+b+"the c of the row with seq one less than myself" this statement has to run over the whole table, in seq order. how can this be acomplished??? cu&thanks erik -- Erik Thiele