Re: Dividing results from two tables with different time frames
От | Aaron Bono |
---|---|
Тема | Re: Dividing results from two tables with different time frames |
Дата | |
Msg-id | bf05e51c0609201024h415efbb5y8c91d665e488a175@mail.gmail.com обсуждение исходный текст |
Ответ на | Dividing results from two tables with different time frames ("Becky Hoff" <bhoff@standoninc.com>) |
Список | pgsql-sql |
On 9/18/06, Becky Hoff <bhoff@standoninc.com> wrote:
Can you provide some data examples. Show a sample of the data you have to query, what results you are getting and what results you are really wanting so we can see where your queries are not giving you what you need.
By your post it sounds like you just need to join your two queries and then use the formula:
Sum(ds.pulled_loan_total) and sum(ds.renew_loan_amount ) / sum(dr.loan_starting_balance + dr.loan_net_change)
but if it were this simple you probably would have it figured out by now. Data examples help us help you much better.
==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com
http://codeelixir.com
==================================================================
The sum(dr.loan_starting_balance + dr.loan_net_change) part of the calculation have a single date, the last day in a date range chosen by the user
Sum(ds.pulled_loan_total) and sum(ds.renew_loan_amount) both have a range of dates chosen by the user
What I need it the result of the second expression divided by the result of the first expression.
By your post it sounds like you just need to join your two queries and then use the formula:
Sum(ds.pulled_loan_total) and sum(ds.renew_loan_amount ) / sum(dr.loan_starting_balance + dr.loan_net_change)
but if it were this simple you probably would have it figured out by now. Data examples help us help you much better.
==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com
http://codeelixir.com
==================================================================
В списке pgsql-sql по дате отправления: