Its been two days and I still can’t figure this out: how do I retrieve all the users who commented on a given article, sort them in descending order by the number of times they commented and then display their username and number of times they commented (i.e., michael (17), laurie (14), jenny (10), dennis (6), etc.)?
Share
Without seeing the database structure, it’s hard to say. But assuming it’s something like this:
Article
Comments
The query would look something like this:
Then you’ll just need to do a
JOINon the user table to get the user’s name.