Re: division by zero issue

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Greg Donald <destiney(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: division by zero issue
Date: 2004-09-15 21:07:03
Message-ID: 20040915210703.GB12624@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)incentre(dot)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(at)svana(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message daniel 2004-09-15 21:25:24 Re: psql + autocommit
Previous Message Martijn van Oosterhout 2004-09-15 20:59:59 Re: what is flushed?