| From: | "Aaron Bono" <postgresql(at)aranya(dot)com> | 
|---|---|
| To: | "Becky Hoff" <bhoff(at)standoninc(dot)com> | 
| Cc: | pgsql-sql(at)postgresql(dot)org | 
| Subject: | Re: Dividing results from two tables with different time frames | 
| Date: | 2006-09-17 16:16:03 | 
| Message-ID: | bf05e51c0609170916t4f7a1aafy2ab5e0f2eb5fd4b@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-sql | 
On 9/15/06, Becky Hoff <bhoff(at)standoninc(dot)com> wrote:
>
> What I'm trying to accomplish is to get two percentages.  Both have one
> element from one table divided by an element in the other table.
>
> sum(ds.pulled_loan_total)/sum(dr.loan_starting_balance +
> dr.loan_net_change)*100 as pulls_percent,
>
> and
>
> (sum(ds.renew_loan_amount)/sum(dr.loan_starting_balance +
> dr.loan_net_change))*100 as renew_percent,
>
> No matter which query I place them in it gives me the wrong data because
> of the time frames.  How can I get the correct data?
>
What time frames do you want?  Are you looking for daily, monthly or
something else?
==================================================================
   Aaron Bono
   Aranya Software Technologies, Inc.
   http://www.aranya.com
   http://codeelixir.com
==================================================================
| From | Date | Subject | |
|---|---|---|---|
| Next Message | James Im | 2006-09-19 09:21:22 | inner join is much faster! is that right? | 
| Previous Message | Joost Kraaijeveld | 2006-09-17 14:56:17 | Re: Transactional behaviour with trigger |