From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Rob Larter <rob(at)cdli(dot)co(dot)uk> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: query help |
Date: | 2003-05-14 15:41:44 |
Message-ID: | 20030514083820.X44794-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, 14 May 2003, Rob Larter wrote:
> hi i am trying to execute the following query:
>
> select source,(b.source/c.total),(select count(*) from entries b where
> source = a.source) as source,(select count(*) from entries c) as total from
> entries a group by source;
>
> it says
> ERROR: Relation "b" does not exist
Right, because it doesn't escape the subselect.
Maybe something like:
select source, ecount/etotalcount, ecount as source, etotalcount as total
from
(select source, count(*) as ecount from entries group by source) as t,
(select count(*) as etotalcount from entries) as t1;
From | Date | Subject | |
---|---|---|---|
Next Message | scott.marlowe | 2003-05-14 15:43:56 | Re: Schedule Jobs in Postgres |
Previous Message | Dennis Gearon | 2003-05-14 15:41:20 | Re: fomatting an interval (resend) |