X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 184C3475AD4 for ; Mon, 10 Feb 2003 00:01:46 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 833EE475AA9 for ; Mon, 10 Feb 2003 00:01:45 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id 4A0B143A94A; Mon, 10 Feb 2003 00:01:45 -0500 (EST) From: "betty" X-Newsgroups: comp.databases.postgresql.sql Subject: Re: conversi ms-sql7 vs postgresql 7.3 Date: Mon, 10 Feb 2003 12:10:57 +0700 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 57 Message-ID: References: <3E438396.2983BD2B@rodos.fzk.de> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 To: pgsql-sql@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/202 X-Sequence-Number: 11600 hi Christoph, your command : "UPDATE xx SET balance=balance+debet-credit " result calculate balance for each row, ex: id debet credit balance 1 1000 0 1000 2 2000 0 2000 3 0 2500 -2500 4 0 100 -100 not result calculate balance, ex: id debet credit balance 1 1000 0 1000 2 2000 0 3000 3 0 2500 500 4 0 100 400 regards betty "Christoph Haller" wrote in message news:3E438396.2983BD2B@rodos.fzk.de... > > > > I have table xx: > > id debet credit balance > > 1 1000 0 0 > > 2 2000 0 0 > > 3 0 2500 0 > > 4 0 100 0 > > > > command in ms-sql 7 can use calculate field (column) balance from id=1 > to > > id=4: > > "update xx set bal=balance=bal+debet-credit" > > result: > > id debet credit balance > > 1 1000 0 1000 > > 2 2000 0 3000 > > 3 0 2500 500 > > 4 0 100 400 > > > > How command sql can use in psotgresql 7.3? > > > Try > UPDATE xx SET balance=balance+debet-credit ; > > Regards, Christoph > > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html