pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: deststar <deststar@blueyonder.co.uk>
To: The Hermit Hacker <scrappy@postgresql.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: WHERE of an AGGREGATE ...
Date: 15 Jun 2003 00:58:03 +0100
Message-ID: <1055635083.2816.6.camel@localhost.localdomain> (raw)
In-Reply-To: <20030614202831.U27289@hub.org>
References: <20030614202831.U27289@hub.org>

Isn't that what the having clause is about?
- Stuart

On Sun, 2003-06-15 at 00:31, The Hermit Hacker wrote:
> I have a query that looks like:
> 
>   SELECT SUM(bytes) AS traffic
>     FROM traffic_table
> GROUP BY ip;
> 
> I want to narrow that SELECT down to a subset, like:
> 
>    SELECT SUM(bytes) AS traffic
>      FROM traffic_table
>     WHERE traffic < ( 100 * 1024 * 1024 )
>  GROUP BY ip;
> 
> which, of course, won't work, cause I need to do the GROUP BY before I do
> the WHERE ... but there has to be a way of coding that so that it does
> work :(
> 
> I'm overlooking something obvious here ... I think?
> 
> Thanks ...
> 
> Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
> Systems Administrator @ hub.org
> primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match




view thread (4+ messages)  latest in thread

Message-ID: <1055635083.2816.6.camel@localhost.localdomain>
Permalink:  ../1055635083.2816.6.camel@localhost.localdomain/
Also on:    postgresql.org/message-id/1055635083.2816.6.camel@localhost.localdomain

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: deststar@blueyonder.co.uk, scrappy@postgresql.org
  Subject: Re: WHERE of an AGGREGATE ...
  In-Reply-To: <1055635083.2816.6.camel@localhost.localdomain>

* 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