Hi there,

Not sure if this is the right place to post this question:

I'm tryting to find a way to do the following without going row by row on the 
client program doing the calculations:

I've got a "movements" table (from an accounting program) for which I've 
already done monthly balances and running balances but now I need to calculate 
the "life" of the balances.

Ie, account 1 is 0 and gets 1000 on day 1, -1000 on day 3. That would make a 
life of two days for this balance. Note this is completely diferent to "average 
balance".

In words that would be "Every time money goes into this account it takes an 
average of X days to go out".

Any ideas on how could I do this calculation inside PostgreSQL to avoid 
transfering all rows to the client?

In case you are curious, I want to do this calculation to see which accounts 
have "balance lifes" to long in order to find accounting errors.

Thanks,
marc


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to