Skip to content
Advertisement

Returning a name from a column using the MAX() function on a different column

I had a quick question on how to return a certain value from a column after using the MAX() function on a different column. For instance, I am trying to return the full name of the comedian depending on who has the highest number of videos posted on youtube. I am able to get the number of videos posted but I am having trouble returning the name. “countc” is the column keeping track of how many youtube videos a comedian has posted. I am using PHPMyAdmin.

JavaScript

Advertisement

Answer

When I get you right you want to order your comedians by the highest number of posted YouTube videos.

Try the following …

JavaScript

If you want to limit the result to the number of resultsets you want to have, just append a LIMIT to your query.

JavaScript

The above shown example limits the result to a single resultset.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement