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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:18:37+00:00 2026-06-11T23:18:37+00:00

I have aSQLite3 database with three tables. Sample data looks like this: Original id

  • 0

I have aSQLite3 database with three tables. Sample data looks like this:

Original

id    aName  code 
------------------
1     dog     DG  
2     cat     CT  
3     bat     BT  
4     badger  BDGR
...   ...     ... 

Translated

id   orgID   isTranslated  langID   aName     
----------------------------------------------
1     2           1         3       katze     
2     1           1         3       hund      
3     3           0         3       (NULL)    
4     4           1         3       dachs     
...   ...         ...       ...     ...        

Lang

id Langcode
-----------
1    FR  
2    CZ
3    DE
4    RU
...  ...

I want to select all data from Original and Translated in way that result would consist of all data in Original table, but aName of rows that got translation would be replaced with aName from Translated table, so then I could apply an ORDER BY clause and sort data in the desired way.

All data and table designs are examples just to show the problem. The schema does contain some elements like an isTranslated column or translation and original names in separate tables. These elements are required by application destination/design.

To be more specific this is an example rowset I would like to produce. It’s all the data from table Original modified by data from Translated if translation is available for that certain id from Original.

Desired Result

id    aName  code    isTranslated
---------------------------------  
1     hund     DG         1
2     katze    CT         1
3     bat      BT         0
4     dachs    BDGR       1
...   ...      ...        ...
  • 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-11T23:18:38+00:00Added an answer on June 11, 2026 at 11:18 pm

    This is a typcial application for the CASE expression:

    SELECT Original.id,
           CASE isTranslated
             WHEN 1 THEN Translated.aName
             ELSE        Original.aName
           END AS aName,
           code,
           isTranslated
    FROM Original
    JOIN Translated ON Original.id = Translated.orgID
    WHERE Translated.langID = (SELECT id FROM Lang WHERE Langcode = 'DE')
    

    If not all records in Original have a corresponding record in Translated, use LEFT JOIN instead.

    If untranslated names are guaranteed to be NULL, you can just use IFNULL(Translated.aName, Original.aName) instead.

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

Sidebar

Related Questions

I have a javascript code that access a sqlite3 database. I would like to
I have a sqlite3 database in which I have corrupt data. I qualify corrupt
Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
I have a sqlite3 full text search table defined like this: CREATE VIRTUAL TABLE
I have this releases table in a SQLite3 database, listing each released version of
I have data stored in a sqlite3 database and have several places that I
Hi I have a sqlite3 database full of data from my previous version of
I have an iPhone application that uses a sqlite3 database for saving data and
I have three tables as a SQLITE3 Dump. products,tax,inventory From these tables preparing a
I have a singleton class which manages data and database handling of my application.

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.