Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9004483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:54:23+00:00 2026-06-16T00:54:23+00:00

I have a table like: file MajorVersion MinorVersion a 0 1 b 0 1

  • 0

I have a table like:

file   MajorVersion MinorVersion
a      0            1
b      0            1
a      0            2
a      0            3
b      1            0
a      1            0
b      1            1

I would like to get each file’s latest version (highest minor version of the highest major version). In this case:

a 1 0
b 1 1

Its seems possible with two joins and group by file, but I thought there maybe a better way. Maybe by use of having?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:54:24+00:00Added an answer on June 16, 2026 at 12:54 am

    Only one join required:

    SELECT   file, MajorVersion, MAX(MinorVersion) MinorVersion
    FROM     my_table NATURAL JOIN (
      SELECT   file, MAX(MajorVersion) MajorVersion
      FROM     my_table
      GROUP BY file
    ) t
    GROUP BY file
    

    See it on sqlfiddle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with 3 columns which looks like this: File User Rating
I have a ms access mdb-file like this: table Main: int recordID int status
I have a sample file like the following: CREATE GLOBAL TEMPORARY TABLE tt_temp_user_11 (
I have a table named POS_File_Detail . I would like to update Line_Number based
I have table like this : ID Name_1 Name_2 Name_3 1 Egon Spengler Ives
I have a table like this ID Name IsDeleted 1 Yogesh Null 2 Goldy
I have a table like this : +-------+------------+------+-----+---------+-------+ | Field | Type | Null
I have a table like this: ID country ------------- 1 US 2 Japan 3
I have a table like this: id | id_parent | tag_name 0 | |
I have table named highscore like this: nameQL scoreQL piotr 50 And flash game

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.