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 6069027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:46:41+00:00 2026-05-23T09:46:41+00:00

I have a MySQL database which has three database tables: news_articles , languages and

  • 0

I have a MySQL database which has three database tables: news_articles, languages and news_articles_languages.

  • The languages table holds a record for each language the system supports
  • The news_articles table holds generic information on a news article, such as ID and an attached image
  • The news_articles_languages table contains localized information on a news article, and also stores revisions.

The structure of the news_articles_languages table is as follows:

id            INT       AUTO_INCREMENT
article_id    INT
language_id   INT
title         VARCHAR
friendly_name VARCHAR
content       TEXT
created       TIMESTAMP

When a news article is saved, the translations are inserted into this table with a new created column, so I can easily query previous revisions.

However, I want to be able to pull out all latest revisions based on an article ID. What would the query for this be? I’ve tried various combinations of GROUP BY and DISTINCT, but these only give one result in one language; I want all languages for a given article.

  • 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-23T09:46:42+00:00Added an answer on May 23, 2026 at 9:46 am

    If the revision with the highest id is always the latest, then the following should work I think. If you can’t depend on that and need to use ‘created’, then I’m not sure!

    SELECT * FROM `news_articles_languages` WHERE id IN(SELECT MAX(id) FROM `news_articles_languages` WHERE article_id = 1 GROUP BY language_id)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mysql database which has grown to over 200 tables in it.
I have a MySQL database with multiple tables, each of which have the same
I have three tables in my database which are: messages topics comments Each of
I have a MySQL database in which table A has a one-to-many relation to
I have a legacy mysql database and there's this table which has a few
I have a MySQL database which has 10 tables in it. The database structure
I have a mySQl innodb database which has a couple of tables which store
i have a large mysql database table in which one column contains values ranging
Greetings friends, In my MySQL database, I have 'MAB' table which contains information about
I have a MySQL database that has a few very simple tables. I would

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.