insert multiple values from one table into one column from another table?


I'm attempting to create an insert statement that gets the values from multiple columns and insert them into one column from another table, is there a simple solution to do this?

Here is something similar to what i'm wanting done, just it's not the correct way to do it, i want value1, value2 and value3 from one table to be combined and put into the value1 column of another table, what am i doing wrong?

INSERT INTO tablename2 (value1 + value2 + value3)
SELECT value1
FROM tablename1

thanks in advance!

7/22/2007 11:55:37 PM 91979 articles. 4 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 41

INSERT INTO tablename2 (SELECT val1 + val2 + val3 FROM tablename1)



Dont forget to click "Mark as Answer" on the post that helped you!
This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers.
7/23/2007 1:04:02 AM

Similar Artilces:

Insert multiple records from one table to another table
Hello. Got a quick problem. I need to post shopping cart items from a temperary table "ShopCart" to a permanent table "tbl_orders". Problem is, I cannot figure out how to iterate through the recordset to post the unique products from "ShopCart" to "tbl_orders". The code below inserts the first product-- but that's it. If there are 6 different products, it will insert the first product 6 times. Public Sub GetShopCart() Dim ordernumber = session("ordernumber") Dim objConn as new SqlConnection(strConn) Dim strSQL as Str...

Get records from one table and insert into another one
I make that but I did not work, thanks  SqlCommand cmd2;cmd = new SqlCommand("SELECT CS_ID FROM Tbl_Conselheiros WHERE CS_TIPO IN (5,6,7)", conn); dr = cmd.ExecuteReader();  while (dr.Read()) {cmd2 = new SqlCommand("SP_PRES_GRAVAR", conn); cmd2.CommandType = CommandType.StoredProcedure;SqlParameter id = new SqlParameter("@ID_CONSE", SqlDbType.Int, 4);id.Value = Convert.ToInt32(dr[0]); cmd2.Parameters.Add(id);SqlParameter data2 = new SqlParameter("@DATA", SqlDbType.VarChar, 8); data2.Value = FormataData(); cmd2.Parameters.Add(data...

selecting one row and inserting it into another table one by one
i ve a table named "Employee" in wh i ve fields "Emp_Id","Name" and "Email". i want to select each employee "Emp_Id" one by one from "Employee" table and insert it into another table named "Concerned_Department". like if i ve three rows in "Employee" table with "Emp_Id" 1,2 and 3 respectively,in this case i want to first select "Emp_Id"=1 then "Emp_id"=2 and lastly "Emp_id"=3 and insert them into "Concerned_Department"table.  after that the process star...

How do i copy / insert a Primary Key value of one table into another table?
  Hi i have set up  two very simple tables, I want a user to be able to create a basic account ( data stored in User_Profile  table with Id set as the Primery Key as Identity) I want the user to be able to be able to return to their account at a later date and then post multiple reviews of different bands they have seen at a later date. I kept the tables in my example very simple so I could get my head around the concept, but generally, I want to connect the Id (PK) value in User_Profile table to the User_Id filed in the User_Review table, so every review th...

Design Question
Hello.I'm wondering what my best options are here....I have one MSSQL2005 table I'll call MSTR_BOL and one called DETAIL_BOL.  The idea is to have one page where a user can enter into MSTR_BOL a header record so to speak.  This header record would have such items as BOL number, Customer number, Carrier and so on.  Then below that (on the form) would be an area to enter DETAIL_BOL items for that MSTR_BOL records.  The link between the two tables would be BOL number.The catch is for a given MSTR_BOL records there are, or can be, multiple MSTR_BOL records.  So, for MSTR...

CheckBoxList gets text from one table, send values to another table
I am working on making a CheckBoxList in a DetailsView that allows the user to check the boxes of the services they would like to receive. In my SQLDataSource, I have two tables that are involved in this. Columns "ServiceID" and "Name"are stored in one table, "Services," and the columns "UserID" and "ServiceID" are stored in another table, "UserServices." I want the CheckBoxList to grab the value and the name of all the services available and have a box for each with the name beside each box. Once the user clicks on each box they want and then click "Submit" I want all rows in table "Use...

is there an sql statement to insert data to one table and getting the data from another table
Ok I have a table that have general categories with just name and CatNo. Now what I want to know is when I create a client to move all the data in general categories to another table called categories that have the clientid to associate it with the client. I would appreciate for any help what is your question here??Shravan Addaypally MCP...

How do obtain Primary Key value from one table aid insert it into another table?
Hi  I have one table called User profile and another table called User Reviews, basically I want to write a query or stored procedure( I don’t know what is best) so that when a registered writes a review, their Id in the User_Profile table is inserted into the User_Review Table in the User_Id field. This is to allow a single user to create multiple reviews.  Can anyone help me with how the code / SLQ query should look to achieve this?  User_Profile Id   int,  ( as primary Identity Key) Name City Country  I have a second table called User Rev...

populating a column in one table with data in a column from another table?
Hi,I have one main table and multiple smaller tables, the main table consists of all the information gathered from the smaller tables, plus some other data. I've set primary keys for all the smaller tables and created a relationship where the primary key id matches an id field inside the main table eg. there's a smalltableid column in both the smaller table and the main table.some misc info:i'm using a dataset (should the key in the dataset be pointing to the main table, or the smaller one?)both relation and foreign key constraints are created (with no rules set)my problem is, the data from ...

can I compare one record from one table to another record in another table?
can I compare one record from one table to another record in another table? I need to test if this condition is met. My scenario is: i need to check one table for a value and compare it to a list of records. for example, table 1           columnrecord 1- applesrecord 2- orangesrecord 3- grapes table 2            col1   col2   col3    col4record 1- Null , Null, Null, grapes I need to compare table 2 records with a list of records from table 1. the fru...

Inserting from datas in one table from Multiple tables
Hi guys,I have a problem with my query. What i want to happen is to populate my table EV_NOTIFICATIONDETAILS (Docownerid, CurrentSentDate, LastSentDate, detailsID, GeneralRemarks) using the datas from the two different tables EV_NOTIFICATIONHEADER and EV_DOCDETAILS.I tried to create some a query but im having a error. The problem is once i insert the data from datas to the columns Docownerid, CurrentSentDate, LastSentDate the datas are stored in the database and when i tried to insert the remaining columns TO EV_NOTIFICATIONDETAILS detailsID, GeneralRemarks getting the datas from EV_DOCDETAI...

copy column from one table to another table
Hi, I have 2 tables. Table1 has column1 and column2. I wish to copy column1 into Table2 by using sql statement. How do i do that? Thank you. In general you'd do it like this: Insert statement: INSERT INTO Table2 ( Column1 ) SELECT Column1 FROM Table1 Update statement: UPDATE Table2 SET Column1 = T1.Column1 FROM Table2 T2 INNER JOIN Table1 T1 ON T2.someID = T1.someID TerriTerri MortonEngagement Manager, NeudesicHow to ask a question...

inserting data from one table to another table..
Hi Guys!  I am stuck on inserting data. Hope you will help me. I have two tables name Customer and Address; Customer(cust_id,name,add_fk);    fk=foreign key,  cust_id and add_id are primary key Address(add_id,street,city,zip); Now, how can I retrieve add_id from Address table and insert into Customer table ( in the add_fk field) using stored procedure with parameters? I am using Oracle 9i.  I would appreciate your help. Thanks! Are you using any of this data in between these actions? (eg: Are they going to reside in your page in a grid, or formview?) ...

Passing value from one control to another and inserting that value in a table
Hey all, sorry if the subject is confusing or has already been covered, but I have (obviously) a problem (at least one).This is using:Visual Studio 2005ASP.NET 2.0SQL Server 2005 ExpressVisual Basic I'm building a CRM system for my company and have run into a snag when attempting to add new customer records for a given client. The first thing that any CSR (or admin) must do upon accessing the CRM system is choose which client's customers they are actually working with (we have multiple clients and are ultimately responsible for providing customer service to the clients' end ...

Web resources about - insert multiple values from one table into one column from another table? -

Multiple sequence alignment - Wikipedia, the free encyclopedia
A multiple sequence alignment (MSA) is a sequence alignment of three or more biological sequences , generally protein , DNA , or RNA . In many ...

Wollstonecraft man's fear of spiders sparks multiple calls to police
When residents of a Sydney north shore street heard a man yelling "I'm going to kill you, you're dead!" followed by a woman's hysterical ...

Girl, 5, stabbed multiple times outside apartment building in Ballarat; man arrested
A five-year-old girl is in a critical condition after being stabbed multiple times in Ballarat.

Multiple probes in case of missing former Olympian and funds' seller
At least three investigations are underway in the case of an investment dealer and former Canadian Olympic rower who has gone missing from Victoria. ...

Tim Hortons Abruptly Shuts Multiple U.S. Locations, Taking Customers, Staff By Surprise 76
Managers and employees at Tim Hortons locations in New York and Maine say they were let go with virtually no notice this week, amid a round of ...

CNN Reporter Describes Multiple Explosions During Overnight Raid
Around 1:30 am ET, CNN’s Atika Shubert was reporting from the Paris suburb of Saint Denis where police were conducting an overnight raid tied ...

Ten killed in multiple bombings, armed attacks around Baghdad
Ten killed in multiple bombings, armed attacks around Baghdad

ROEV lets you use multiple charging networks with one account
Filed under: Green , Green Automakers , Electric Blink, ChargePoint, and EVgo are partnering up with ROEV, a new association that will let you ...

Kate Hudson dumped Nick Jonas because she ‘wants to pursue multiple people’
... But not for long, The source also said the Bride Wars star wants to get into the dating scene again. And soon. ‘Kate wants to pursue multiple ...

Manage multiple Google marketing accounts easily
... you work with any partners, vendors, agencies, or clients, you probably even have Google logins for them. The uncomfortable reality of multiple ...

Resources last updated: 11/27/2015 5:13:47 PM