if you use an alias in your select clause
use the same alias in the having clause
so having num > 1

-----Original Message-----
From: Ben Smith [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 31, 2001 11:00 AM
To: [EMAIL PROTECTED]
Subject: COUNT and WHERE


Hello,

I have this query

select a.match_id, count(a.players_id) as num, a.description
from a
group by a.players_id, a.match_id
order by num desc

I only want to see the records where the count of players_id is greater than
1, and in various other DB's i'd use the Having clause, so i tried
where count(a.players_id)>1

but mySQL said Invalid use of Group By function, which i guess is
understandable.

I'm sure there is an easy solution, anyone with any suggestions ?
thanks in advance.

Ben.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to