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

  • Home
  • SEARCH
  • 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 3996982
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:20:44+00:00 2026-05-20T07:20:44+00:00

Is there any way to do this in one sql query? I would like

  • 0

Is there any way to do this in one sql query? I would like to get the newest (version) of the same entry in every language available.

My table and example data is:

ID  |  Index  |  Version  |  Language  | ...
------------------------------------------------
1        1          1            1         test1
2        1          2            1         test2
3        2          1            1         test3
4        2          1            2         test4
5        2          1            3         test5
6        2          2            3         test6
7        3          1            1         test7
8        3          1            2         test8
  • ID is unique identifer
  • Index is unique for any entry in database which means that all time versions and language version of the same article/entry share the same Index.
  • Version is obviously version number. 1 is the first version and any greater number is usually newer.
  • Language is the number of language version of entry/article.

I really can’t think of way to get this in one query. But maybe it’s feasible?

I would like to get something like this:

ID  |  Index  |  Version  |  Language  | ...
------------------------------------------------
2        1          2            1         test2
3        2          1            1         test3
4        2          1            2         test4
6        2          2            3         test6
7        3          1            1         test7
8        3          1            2         test8

test1 is out because test2 is in the same language and it’s newer
test5 is out because test6 is newer in the same language

Resolved

SELECT T1.* FROM entry_view T1 
LEFT JOIN entry_view T2 ON (T1.version < T2.version AND T1.id_language = T2.id_language AND T1.`index` = T2.`index`)
WHERE T2.ID IS NULL
  • 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-05-20T07:20:44+00:00Added an answer on May 20, 2026 at 7:20 am
        SELECT T1.ID, T1.Index, T1.Version, T1.Language FROM Table T1 
    LEFT JOIN Table T2 ON (T1.ID < T2.ID AND T1.Language = T2.Language) 
    WHERE T2.ID IS NULL
    

    Edit: i assumed the IDs were increasing and the newest one would be the last.

    maybe try this:

    SELECT T1.ID, T1.Index, T1.Version, T1.Language FROM Table T1 
    LEFT JOIN Table T2 ON (T1.Version < T2.Version AND T1.Language = T2.Language)
     WHERE T2.ID IS NULL
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.