dolrich06 0 Report post Posted September 17, 2009 (edited) How can i order them by the most number of attractions or most number of rewards? Tablesmember table - the main table member_id | name1 dolrich2 test3 sampleattraction table attraction_id | member_id 1 12 23 24 35 36 37 3 What i want is that i can order by them by their number of attractionsHere is the result expected.member_id attractions count3 42 21 1 Here is the query for counting the number of attractions and rewards of each member.SELECT a.member_id, count(b.member_id) as attractions, count(c.member_id) as rewards FROM member a LEFT OUTER JOIN attraction b ON a.member_id = b.member_id LEFT OUTER JOIN reward c ON a.member_id = c.member_id GROUP BY a.member_id Edited September 17, 2009 by dolrich06 (see edit history) Share this post Link to post Share on other sites