Re: need some help on figuring out how to write a query

From: "Dean Gibson (DB Administrator)" <postgresql(at)ultimeth(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: need some help on figuring out how to write a query
Date: 2008-02-22 02:09:42
Message-ID: 47BE2EE6.1020502@ultimeth.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alex Turner 2008-02-22 02:28:49 Re: Postgres 8.3 broke everything
Previous Message brian 2008-02-22 01:48:28 Re: New inst. 8.3.0 has no client