pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Larter <rob@cdli.co.uk>
To: pgsql-general@postgresql.org
Subject: query help
Date: Wed, 14 May 2003 11:55:47 +0100
Message-ID: <NNEPLOAAHJIJEHEKMMIOGEAMCJAA.rob@cdli.co.uk> (raw)

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




view thread (70+ messages)  latest in thread

Message-ID: <NNEPLOAAHJIJEHEKMMIOGEAMCJAA.rob@cdli.co.uk>
Permalink:  ../NNEPLOAAHJIJEHEKMMIOGEAMCJAA.rob@cdli.co.uk/
Also on:    postgresql.org/message-id/NNEPLOAAHJIJEHEKMMIOGEAMCJAA.rob@cdli.co.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: rob@cdli.co.uk
  Subject: Re: query help
  In-Reply-To: <NNEPLOAAHJIJEHEKMMIOGEAMCJAA.rob@cdli.co.uk>
  References: <NNEPLOAAHJIJEHEKMMIOGEAMCJAA.rob@cdli.co.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox