Skip to content
Advertisement

SQL Query to get column values that correspond with MAX value of another column?

Ok, this is my query:

When it pulls the data, I get the correct row for the video_id, but it pulls the first row for each category for the others. So when I get the max result for the video_id of category 1, I get the max ID, but the first row in the table for the url, date, title, and description.

How can I have it pull the other columns that correspond with the max ID result?

Edit: Fixed.

Advertisement

Answer

I would try something like this:

which is quite faster that your own solution

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