[SQL] Where of an aggregate

2003-06-15 Thread vali
HI! Try this select c.traffic from (select sum(bytes) as traffic from traffic_table group by ip) c where c.traffic<(100*1024*1024); ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregis

Re: [SQL] WHERE of an AGGREGATE ...

2003-06-14 Thread The Hermit Hacker
perfect, its one of those that I've used so rarely, I never thought about it ... thanks :) On Sat, 15 Jun 2003, deststar wrote: > 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

Re: [SQL] WHERE of an AGGREGATE ...

2003-06-14 Thread deststar
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(byte

[SQL] WHERE of an AGGREGATE ...

2003-06-14 Thread The Hermit Hacker
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,