SELECT ll.id, ll.title, ll.description, ll.viewed, ll.upload_date, ll.url, ll.category, ll.language, ll.media_type, lm.id AS member_id, lm.username, lm.real_name, lm.private_avatar, COUNT(ls.id) AS number_of_votes, AVG(ls.score) AS score, COUNT(lc.id) AS number_of_comments FROM link_links AS ll LEFT JOIN link_comments AS lc ON ll.id = lc.link_id # one to many LEFT JOIN link_score AS ls ON ll.id = ls.link_id # one to many LEFT JOIN link_members AS lm ON ll.uploader = lm.id # one to one GROUP BY lc.link_id, ls.link_id # group by the id thats shared between results ORDER BY ll.id DESC LIMIT 0, 20 # link_links (which are? maybe turtles for all i know) # select all tutles and the info they have on them # from the turtle pool # but if there are comments on these turtles we want those too # also, if there are votes on these turtles we want to see them and their scores # also, if there is info regarding the turtles owner we want that too # group all this data based on each turtle (one result per turtle) # order all this data by which turtle was added to the pool last # and only show us 20 turtles total