query help

From: "Rob Larter" <rob(at)cdli(dot)co(dot)uk>
To: <pgsql-general(at)postgresql(dot)org>
Subject: query help
Date: 2003-05-14 10:55:47
Message-ID: NNEPLOAAHJIJEHEKMMIOGEAMCJAA.rob@cdli.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

the query:
select source,(select count(*) from entries where source = a.source) as
source,(select count(*) from entries) as total from entries a group by
source;

works fine but i want to use the result from source and entries to work out
a percentage in the sql query
could someone point me in the right direction?

Thanks!

Rob

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Madhavi Daroor 2003-05-14 11:17:03 Schedule Jobs in Postgres
Previous Message Mirco Tamburini 2003-05-14 10:40:52 Heterogeneous service (like Oracle or Ms SQL Server)