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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:11:43+00:00 2026-05-11T21:11:43+00:00

Table A Col1 Col2 101 102 101 103 102 104 104 105 Table B

  • 0
Table A
Col1 Col2
101  102
101  103
102  104
104  105

Table B
Col1
101
102
103
104
105

I want to take data from Table A and insert it into Table B as a Distinct value in one query
so INSERT INTO TableB (Col1) (SELECT ...)

Any ideas?

  • 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-11T21:11:43+00:00Added an answer on May 11, 2026 at 9:11 pm

    You should be able to do:

     INSERT INTO TableB (Col1)
     (SELECT Col1 FROM TableA
      UNION
     SELECT Col2 FROM TableA)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running a pretty standard INSERT INTO [table] (col1, col2, ...coln) select * from
Is it possible to do something like this: INSERT INTO table(col1, col2) VALUES(something_from_another_table, value);
say, I have a table TABLE(col1,col2,col3) and, I want create a index INDEX(col1=table.col1+table.col2)
Below is the example that I want to do: declare @table table(col1 varchar(10),col2 varchar(10));
I have a table data as col1 col2 col3 col4 11 12 xx yy
Here is my table data...lets call this table TABLEX ID COL1 COL2 ------------------------------ 100
I am getting this JSON string from an ASP.Net webservice: {d:{Table:[{col1:123,col2:name,col3:name,col4:100,col5:\/Date(1153033200000)\/},{col1:123,col2:name,col3:name,col4:101,col5:\/Date(1153033200000)\/},{col1:123,col2:name,col3:name,col4:102,col5:\/Date(1153033200000)\/}]}} In my jQuery
I have the following table: Col1 Col2 A ... A ... A B B
See the below table: col1 col2 ---- ---- 1 | a 2 | b
I have a table like Table1: col1 col2 col3 and have an index over

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.