pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: betty <liongliong@telkom.net>
To: pgsql-sql@postgresql.org
Subject: Re: conversi ms-sql7 vs postgresql 7.3
Date: Mon, 10 Feb 2003 12:10:57 +0700
Message-ID: <b27bnl$1gb8$1@news.hub.org> (raw)
References: <3E438396.2983BD2B@rodos.fzk.de>

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" <ch@rodos.fzk.de> 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





view thread (6+ messages)  latest in thread

Message-ID: <b27bnl$1gb8$1@news.hub.org>
Permalink:  ../b27bnl$1gb8$1@news.hub.org/
Also on:    postgresql.org/message-id/b27bnl$1gb8$1@news.hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: liongliong@telkom.net
  Subject: Re: conversi ms-sql7 vs postgresql 7.3
  In-Reply-To: <b27bnl$1gb8$1@news.hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox