pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Muhyiddin A.M Hayat <middink@indo.net.id>
To: pgsql-sql@postgresql.org
Subject: Calc
Date: Thu, 16 Oct 2003 03:59:21 +0800
Message-ID: <002e01c39356$d5885ca0$1f00a8c0@middinkcomp> (raw)

Dear all,

I have below table

+-----+--------------------+---------------------+
 | id   |    db                    |cr                          |
+-----+--------------------+---------------------+
 |1     |                            | 200                      |
 |2     | 100                    |                              |
 |3     | 100                    |                              |
 |4     | 150                    |                              |
 |5     |                            | 200                      |

I Would like to calc that balance, and look like

+-----+--------------------+---------------------+-----------+
 | id   |    db                    |cr                          | bal        |
+-----+--------------------+---------------------+-----------+
 |1     |                            | 200                      |200       |
 |2     | 100                    |                              |100       |
 |3     | 100                    |                              |0            |
 |4     | 150                    |                              |-150      |
 |5     |                            | 200                      |50         |


What can I do to get result like that

view thread (6+ messages)  latest in thread

Message-ID: <002e01c39356$d5885ca0$1f00a8c0@middinkcomp>
Permalink:  ../002e01c39356$d5885ca0$1f00a8c0@middinkcomp/
Also on:    postgresql.org/message-id/002e01c39356$d5885ca0$1f00a8c0@middinkcomp

 · 

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: middink@indo.net.id
  Subject: Re: Calc
  In-Reply-To: <002e01c39356$d5885ca0$1f00a8c0@middinkcomp>

* 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