Re: need some help on figuring out how to write a query - Mailing list pgsql-general

From Dean Gibson (DB Administrator)
Subject Re: need some help on figuring out how to write a query
Date
Msg-id 47BE2EE6.1020502@ultimeth.com
Whole thread Raw
In response to need some help on figuring out how to write a query  (Justin <justin@emproshunts.com>)
Responses Re: need some help on figuring out how to write a query
List pgsql-general
On 2008-02-21 13:37, Justin wrote:
> ...  I'm wondering if there is a way to create this in a single select
> statement??
> I can't think of a way to do it???
Break down your problem using VIEWs.  Create a VIEW that gets just ONE
of the averages, based on a starting date.  Then create a SELECT that
gets data from the VIEW as though it was an actual table.

Once you get it working, you can replace the reference to the VIEWs in
the SELECT statement, with the definition of the VIEWs, but I would not
do that unless the result is relatively simple and easy to understand.
Maintainability should be your goal.

-- Dean

--
Mail to my list address MUST be sent via the mailing list.
All other mail to my list address will bounce.


pgsql-general by date:

Previous
From: brian
Date:
Subject: Re: New inst. 8.3.0 has no client
Next
From: "Alex Turner"
Date:
Subject: Re: Postgres 8.3 broke everything