Average Balance "life"

Поиск
Список
Период
Сортировка
От telenieko@gmail.com
Тема Average Balance "life"
Дата
Msg-id 1e95e269-693e-4ec1-bdea-8bc5a33dbfc5@googlegroups.com
обсуждение исходный текст
Ответы Re: Average Balance "life"  ("David Johnston" <polobo@yahoo.com>)
Список pgsql-general
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
balancesbut 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
thisis 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
findaccounting errors. 

Thanks,
marc


В списке pgsql-general по дате отправления:

Предыдущее
От: r d
Дата:
Сообщение: fuzzystrmatch module buggy? observations
Следующее
От: RAJDEEP SARDAR
Дата:
Сообщение: Select Query Implementation:Details needed