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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:29:10+00:00 2026-06-03T17:29:10+00:00

I have the following tables: Table A: id int v1 string v2 string Table

  • 0

I have the following tables:

Table A:
id int
v1 string
v2 string

Table B:
key int
val string

Table A_v2:
id int
v1 int
v2 int

I have data loaded in tables A and B. I am trying to convert table A to table A_v2, by replacing each value (in columns v1 and v2) with the corresponding key from table B.

I hope this makes sense. If not I can give an example.
I am using SQLite.

How would I write the insert?

EDIT
Here is an example:

Row in A:
1 | abc | def

Rows in B:
5 | abc
42 | def

Row in A_v2 should then be:
1 | 5 | 42

  • 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-03T17:29:12+00:00Added an answer on June 3, 2026 at 5:29 pm

    As what I understood is .. you want to replace V1 and V2 column of TABLE_A with value of column VAL in TABLE_B.

    if so you can use following query ..

    create table table_a_v2 as 
           select * from table_a where 1>1;
    

    and to insert into this table –

    insert into table_a_v2 
    select a.id,
           (select key from table_b whare val= a.v1) v1,
           (select key from table_b whare val= a.v2) v2
     from table_a
    

    I am not much sure about sqlite .. but this commands are valid and working as per oracle database.

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

Sidebar

Related Questions

I have the following tables: create table TableA ( Id int primary key identity,
I have a table in db2 which has the following fields int xyz; string
I have the following tables CREATE TABLE `files` ( `fileid` int(11) NOT NULL AUTO_INCREMENT,
I have an SQL table with basically the following structure: PK (int, primary key),
In our database, we have the following tables Tags Id (int) Name (string) IsActive
suppose I have the following tables and relations: CREATE TABLE [dbo].[Customers] ( [CustomerID] [int]
Let's say we have the following table: CREATE TABLE T ( ID INT, String1
I have the following table: ID (int) EMAIL (varchar(50)) CAMPAIGNID (int) isSubscribe (bit) isActionByUser
I have the following table: id INT (PRIMARY) score INT I'd like to know,
I have the following table: create table ARDebitDetail(ID_ARDebitDetail int identity, ID_Hearing int, ID_AdvancedRatePlan int)

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.