Retrieve records from a database table where the value of a certain column is th

  • I have a simplified version of a table for organizing documents here.

    table

    What is the most efficient way to select the highest rev value for each id?

    Using the above data, the result should be two rows when using MySQL: [1, 3, ...] and [2, 1, ..].

    I employ checks within the while loop to identify and replace outdated revisions in the resultset. I got this problem post from here.

    Is there a SQL solution that can achieve the same result other than this method?

  • The page that you linked to contains three separate approaches to a very similar problem.  If you are having problems with one or more of those approaches, show us what you have tried and we'll help you through it.  Right now, it looks like you just want to be spoon-fed the answers.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • Agree with Drew.

    Yes, show us what you tried. I give some additional info., understand how GROUP BY works and when to use it.

    =======================================================================

  • This was removed by the editor as SPAM

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply