Finding and Ordering by associations

Hi! You migh want to use aggregate function say count. Regards, Swanand