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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:52:41+00:00 2026-06-04T13:52:41+00:00

So, I have three tables, table local, table item and table item_local. Here is

  • 0

So, I have three tables, table “local”, table item and table “item_local”. Here is data contains in the tables:

Table "local"
    ID  Local
    1   Ru
    2   En

Table "item"
    ID  Name
    1   Test1
    2   Test2
    3   Test3

Table "item_local"  
    ID  ItemID  LocalID Text
    1   1       1       Test-Ru
    2   1       2       Test-En
    3   2       1       Test-Ru
    4   2       2       Test-En
    5   3       1       Test-Ru

My problem is I don’t know the SELECT query with local that will display the result such as below:

Result if i select with local "Ru":
    ID  ItemID  LocalID Text
    1   1       1       Test-Ru 
    3   2       1       Test-Ru 
    5   3       1       Test-Ru

Result if i select with local "En": 
    ID  ItemID  LocalID Text
    2   1       2       Test-En
    4   2       2       Test-En
    5   3       1       Test-Ru

Is there a query or any other way to get such the result?

Anyway, thanks for helping.

  • 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-04T13:52:43+00:00Added an answer on June 4, 2026 at 1:52 pm
    SELECT il.ID, il.ItemID, il.LocalID, il.Text
    FROM item i
    JOIN local l ON l.Local='Ru'
    [LEFT] JOIN item_local il ON i.ID=il.ItemID AND il.LocalID=l.ID
    

    Note that the table item is not necessary. However, I guess you would like to see the missing entries in the step. This can be done by using the LEFT JOIN and add the condition WHERE il.ID IS NULL.

    Edit: Oh, is missed the fallback to “Ru”.

    -- try 'En'
    SELECT il.ID, il.ItemID, il.LocalID, il.Text
    FROM item_local il
    JOIN local l ON l.Local='En' AND l.ID=il.LocalID
    UNION
    -- fallback to 'Ru'
    SELECT il.ID, il.ItemID, il.LocalID, il.Text
    FROM item_local il
    JOIN local l ON l.Local='Ru' AND l.ID=il.LocalID
    WHERE il.ItemID NOT IN (
        SELECT il.ItemID
        FROM item_local il
        JOIN local l ON l.Local='En' AND l.ID=il.LocalID
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this three tables. Table: Item Columns: ItemID, Title, Content, NoChange (Date) Table:
I have three tables like this: Person table: person_id | name | dob --------------------------------
I have three tables, Name - columns Custpackingslipjour(table 1) - (deliverydate, dateclosed,, salesid) Inventrans
Say I have three tables: Fruit (Table 1) ------ Apple Orange Pear Banana Produce
I have three tables Category, Movies and RelCatMov Category-table categoryid, categoryName 1 thriller 2
I have three tables. The designs were like student table create table student (studID
I have a table which needs to link one of three seperate tables, but
I have users table. There are three other tables: developers, managers, testers. All of
I have three tables A: A.pID primary key, A.Name nvarchar(250) B: B.pID primary key,
I have three tables: Project: ... relations: User: local: authorId foreign: id Users: class:

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.