X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 11358D1B8F5 for ; Wed, 20 Aug 2003 16:31:54 -0300 (ADT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 69408-08 for ; Wed, 20 Aug 2003 16:31:44 -0300 (ADT) Received: from web41611.mail.yahoo.com (web41611.mail.yahoo.com [66.218.93.111]) by svr1.postgresql.org (Postfix) with SMTP id 816DFD1B904 for ; Wed, 20 Aug 2003 16:31:42 -0300 (ADT) Message-ID: <20030820193143.23054.qmail@web41611.mail.yahoo.com> Received: from [66.139.64.60] by web41611.mail.yahoo.com via HTTP; Wed, 20 Aug 2003 12:31:43 PDT Date: Wed, 20 Aug 2003 12:31:43 -0700 (PDT) From: George McQuade Subject: Table conversion query... To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/237 X-Sequence-Number: 14853 Hello everyone, I have a table that looks like: date tran gl amt 08/20/03 1001 3010 -30.00 08/20/03 1001 1030 -300.00 08/20/03 1001 1060 +330.00 08/20/03 1002 ...next transaction ... and I need to convert to: date glcr gldb amt 08/20/03 1060 3010 30.00 08/20/03 1060 1030 300.00 in other words, the negative gl's go into gldb and they make up the total for the positive gl. is there a way to accomplish this in postgresql? or should I implement it inside the java app? thanks george __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com