I Have two tables
1. Class table
2. notification table
class table contains all the details of classes likewise
classid | name
1 myclass
2 yourclass
3 ourclass
and the notification table contains
noty_id | notificationname | class_id
1 editing 1
2 insertion 1
3 answered 2
4 answered updated 2
5 deleted 3
Above table will yield the counts grouped by classid as given below
SELECT class_id, COUNT(*) AS classcnts FROM notification GROUP BY class_id
Now I want the class table to be displayed in the descending order of count obtained from notification table, how can i combine both queries to get the result.
Thanks In Advance
Try this: