Hello.

On Wed 2002-10-30 at 16:45:00 -0800, [EMAIL PROTECTED] wrote:
> Hello,
> 
> I am trying to query a table for all unique ID's that have an average of
> "10".
> 
> carrier_id    rating
> =============
> 34               10
> 36                8
> 30                9
> 34               10
> 
> My result should be carrier_id 34 as it is the only carrier with an average
> rating of 10.
> 
> Any ideas?

Something like the following should work:

SELECT    carrier_id, AVG(rating) AS average
FROM      unnamed
WHERE     whatever-additional-condition-you-like
GROUP BY  carrier_id
HAVING    average = 10

HTH,

        Benjamin.

-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
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