Re: division by zero issue - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: division by zero issue
Date
Msg-id 20040915210703.GB12624@svana.org
Whole thread Raw
In response to Re: division by zero issue  (Greg Donald <destiney@gmail.com>)
List pgsql-general
On Wed, Sep 15, 2004 at 02:10:45PM -0500, Greg Donald wrote:
> On Wed, 15 Sep 2004 12:54:07 -0600, Guy Fraser <guy@incentre.net> wrote:
> > This might work better.
>
> Thanks, I got it working finally.  It wouldn't go without any fields
> in the second SELECT, but I added them and now it works.
>
> Where can I find docs for the 'as intermediate' part of this query.  I
> never heard of it and can't seem to find it in the manual other than
> it's listing in the SQL keywords table.  I see what it does but still
> want to read the docs about it.

It's a called subquery. Everything in the brackets is a query which
produces a result and is aliased to the name "intermediate". The outer
query can then use it as a source table like any other table.

Ofcourse, optimisation might mean it gets optimised away, but that's
the basic idea...

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: what is flushed?
Next
From: daniel
Date:
Subject: Re: psql + autocommit