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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:49:03+00:00 2026-05-25T20:49:03+00:00

I created two tables to manage a multi language article system : table1 is

  • 0

I created two tables to manage a multi language article system :

  • table1 is a table which is used as an index of all the articles registered

    table1 = (ART_ID, ART_AUTHOR, ART_DATE)

  • table2 is a table which is used to store all languages versions of an article

    table2 = (LOC_ID, LOC_TITLE, LOC_TEXT, LOC_LANG, ART_ID)

My goal is the following:

If I select English as language;

  1. I need to see the articles with an existing English localisation so
    I can edit them,
    [if there is a localisation matching the selected language then it returns this one as table2 data’s].

  2. I also need to see the articles without any localisation yet (but the
    article index exists in the table1 already) so I can write the English
    version,
    [if there is no localisation at all for the article, then it returns null data’s as table2 data’s].

  3. And finally, I need to see the articles that already have a localisation in
    another language so I can write the English version.
    [if there is no localisation matching the selected language but there is another localisation, then it returns null data’s as table2 data’s.]

but I was unable to write the good query until now…


If I use:

SELECT table1.ART_AUTHOR, table1.ART_DATE, table2.LOC_TITLE, table2.LOC_TEXT
       FROM table1
       LEFT JOIN table2 ON ( table1.ART_ID = table2.ART_ID )

it returns all the article in all languages, but I need null data’s if the selected language is not yet localized. So it’s not good.


If I use:

SELECT table1.ART_AUTHOR, table1.ART_DATE, table2.LOC_TITLE, table2.LOC_TEXT
       FROM table1
       LEFT JOIN table2 ON ( table1.ART_ID = table2.ART_ID )
       WHERE table2.LOC_LANG = 'en'

it returns all the article written in English, but not those without any localisation neither those with localisation in another language. So it’s not good.


If I use:

SELECT table1.ART_AUTHOR, table1.ART_DATE, table2.LOC_TITLE, table2.LOC_TEXT
       FROM table1
       LEFT JOIN table2 ON ( table1.ART_ID = table2.ART_ID )
       WHERE table2.LOC_LANG = 'en' OR table2.LOC_LANG IS NULL

it returns all the article written in English and all article without localisation at all, but not those with localisation in another language. So it’s not good.


I tried with some sub-queries and exists or not exists but nothing was reaching the goal.

Does anybody knows something I could use in order to get this working ?
Is this is even possible ?

Thank you.

  • 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-25T20:49:04+00:00Added an answer on May 25, 2026 at 8:49 pm

    Try to put the condition in the left join:

    SELECT table1.ART_AUTHOR, table1.ART_DATE, table2.LOC_TITLE, table2.LOC_TEXT
     FROM table1
     LEFT JOIN table2 ON table1.ART_ID = table2.ART_ID
                     and table2.LOC_LANG = 'en'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First.. here are the two tables I've created (sans irrelevant columns).. CREATE TABLE users_history1
I have two relational tables: the Profiles table which contains 3 kinds of user
I created two tables: Publisher PK, PublisherId, int, not null, indentity +1 PublisherName, varchar(50),
I basically created some tables to play around with: I have Two main tables,
I have two tables: codes_tags and popular_tags. codes_tags CREATE TABLE `codes_tags` ( `code_id` int(11)
I have two tables: entitytype and project . Here are the create table statements:
I have two tables A and B as defined bellow. create table A (
I'm porting a process which creates a MASSIVE CROSS JOIN of two tables. The
I have two tables - users and stores . there is a third table
I programmatically created a login view and a table view. Under certain circumstances which

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.