List:General Discussion« Previous MessageNext Message »
From:Colin McKinnon Date:September 21 1999 3:39pm
Subject:Re: GROUP BY problem
View as plain text  
At 13:59 21/09/99 GMT, Steven Fletcher wrote:
>Hi all.
<snip>
>select count(chan.channel),nick.nick from chan, nick where
>(count(chan.channel) > "10" and chan.founder=nick.nick) group by
>nick.nick;
<snip>

Stuff in the where clause is evaluated before anyconsolidation is done -
i.e. count() is meaningless here; use a HAVING clause instead:

SELECT COUNT(chan.channel),nick.nick 
FROM chan, nick
WHERE chan.founder=nick.nick
GROUP BY nick.nick
HAVING count(chan.channel) > "10";

HTH
Colin


Thread
GROUP BY problem(Steven Fletcher)21 Sep
  • Re: GROUP BY problem(Steven Fletcher)21 Sep
  • Re: GROUP BY problemBob Kline21 Sep
  • Re: GROUP BY problemColin McKinnon21 Sep
    • Re: GROUP BY problemBob Kline21 Sep
  • Re: GROUP BY problemJules Bean21 Sep