I have a table with comments. These comments are related to another table of questions, through 1-to-many relation, i.e. 1 question to many comments. Now, I want a list of 5 questions with the maximum number of comment counts (in succession of course). So, my query should return something like:
Question Id:4 with 30 comments
Question Id:2 with 27 comments
Question Id:11 with 22 comments
Question Id:5 with 15 comments
Question Id:14 with 10 comments
Can I achieve this through 1 query or multiple ones? And how?
This query gets the data you need. You can handle the output formatting as desired.