Programming in sql: MYSQL Join help. Get results based on number of comments in seperate comments table? on newest questions tagged sql – Stack Overflow

Beginner here! I am trying to write a query that will select the 3 most commented on results from a “results” table the comments are stored in a seperate “comments” table.

results
 - id
 - title
 - body
 - etc
 - etc

comments
 - id
 - result_id
 - user_id
 - timestamp
 - comment

So I need to select all from results and order by the amount of matches between results.id and comments.result_id but I don’t really know where to start!

Thanks a lot for the help, it’s much appreciated!

See Answers


source: http://stackoverflow.com/questions/11634118/mysql-join-help-get-results-based-on-number-of-comments-in-seperate-comments-ta
Programming in sql: programming-in-sql



online applications demo