pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aaron Bono <postgresql@aranya.com>
To: Becky Hoff <bhoff@standoninc.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Dividing results from two tables with different time frames
Date: Wed, 20 Sep 2006 12:24:09 -0500
Message-ID: <bf05e51c0609201024h415efbb5y8c91d665e488a175@mail.gmail.com> (raw)
In-Reply-To: <4B2BD8A084A0B442ABF42645DB572A5F28DD52@fr-fs1.StandonInc.com>
References: <4B2BD8A084A0B442ABF42645DB572A5F28DD52@fr-fs1.StandonInc.com>

On 9/18/06, Becky Hoff <bhoff@standoninc.com> wrote:
>
>  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.
>

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
==================================================================

view thread (4+ messages)

Message-ID: <bf05e51c0609201024h415efbb5y8c91d665e488a175@mail.gmail.com>
Permalink:  ../bf05e51c0609201024h415efbb5y8c91d665e488a175@mail.gmail.com/
Also on:    postgresql.org/message-id/bf05e51c0609201024h415efbb5y8c91d665e488a175@mail.gmail.com

 · 

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: postgresql@aranya.com, bhoff@standoninc.com
  Subject: Re: Dividing results from two tables with different time frames
  In-Reply-To: <bf05e51c0609201024h415efbb5y8c91d665e488a175@mail.gmail.com>

* 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