This is untested, but should work:

select *
from (
  select shows.showId, shows.showTitle, (
    select avg(rating)
    from airdates
    where showId = shows.showId
  ) as avgRating
) t
order by avgRating

cheers,
barneyb

On 11/7/05, Les Mizzell <[EMAIL PROTECTED]> wrote:
> Just looking for ideas...
>
> Assume I have a database with TV Miniseries
> It's a mySQL database.
>
> TABLES
> -----
> 1. SHOWS
>     a. showID
>     b. showTITLE
> 2. AIRDATES
>     a. showID
>     b. airdate
>     c. rating
>
> Now, since it's a miniseries, it will have multiple entries in the
> AIRDATES table for each night (part 1, 2, 3, blah, blah..). I need to
> AVERAGE the rating for all airdates for each specific title, and then
> sort on the average.
>
> I've come up with a couple of VERY convoluted ideas, but the operative
> word here is convoluted.
>
> How would any of you approach this?
>
>
> --
> -----------
> Les Mizzell

--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 100 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:223642
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to