Need to transfer certain rows from one table into another table

On my online store, I need to figure out with sql how I can copy data from several different tables into another table:

 

There is a table that contains all of the customers billing info

another table has customer's shipping info

 

The target table is for tracking and processing orders.  I will need to populate different fields from different tables, as well as insert values into fields from my code behind (i.e. customers can choose different types of shipping, payment options).  I googled this and keep running into the join statement (which I use all the time).  I don't need to join anything for displaying, I literally need insert data into a column in my orders table, just not sure what the sql syntax is for that. 

0
Guitarmonster
4/10/2007 7:57:35 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
568 Views

Similar Articles

[PageSpeed] 48

You can use an "Insert Into" SQL statement similar to this:

INSERT INTO MyTable  (Name, Description)
       SELECT Name, Description
       FROM MyOtherTable WHERE ID = 5;


Steve Wellens

My blog
0
SGWellens
4/10/2007 10:06:00 PM
Reply:

Similar Artilces:

Deleting rows from one table based upon rows in another table
I need to delete rows from table1 based on rows in table2. table1 has 1.5 million rows from which I need to delete 20,000 existing in table2. The table structures are the same and I must exactly match 10 (of the 15) columns in the tables. I also need to limit the number of rows being worked on, in a single transaction, to 500 or so. Hi Mike, try the following: set rowcount 500 DELETE table1 from table1 t1,table2 t2 where t1.col1=t2.col1 and t1.col2=t2.col2 and t1.col3=t2.col3 and ........ t1.col10=t2.col10 HTH. Regards P:S You must re-execute the DML statement above 40 time...

How to change the Rows of the one table to another table
I want's to change the layout of my table at run time on the basis of some of my Setting File[I don't want's to use webpart orwebzones]Suppose I have three Tables with number of rows.[In reality Each row will contain some controls]On Page_Preinit I want's to set the rows of one table to another also want's to change order of the rows.How Can I do that ?  <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional/...

Copying html table rows from one table to another.
Hi Im am trying to copy table rows from one html table to another. Below is a one of my many attempts and all this does is moving the rows from the one table to the other. I would appreciate any help. int iCount; HtmlTableRow[] TableRows = new HtmlTableRow[Table1.Rows.Count]; Table1.Rows.CopyTo(trs,0); for (iCount = 0; iCount < TableRows.Length; iCount++) { Table2.Rows.Add(TableRows[iCount]); } Thanks ...

Transfering tables and data from one MS SQL DB to another MS SQL DB
I need to transfer tables and data from one SQL DB to another SQL DB. I know it can be done with Server Management Studio and I have searched Studio and Help but can't find any info on the database migration wizard. Hi,jayd  Follow This Link U can Get Help From This For Ur Case    http://forums.asp.net/t/1352620.aspx   PLZ MARK AS ANSWER IF IT HELP U. THANKS. RAGHAV MVP ASP/ASP.Net Read My Blog MARK THE POST AS ANSWER IF IT HELPS U. "Success doesn't come to you…you go to it."--Marva Collins "Success does not come to those who w...

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...

Update a rows in one table for each row in other table
Hello all, i am a newbie in SQL and i want to ask for your help in order to do the following update statement. I have a table tblUsers which holds all the users, one of the fields in their GroupId. In the UserGroup table i have a field "UsersCount" and in that field i want to keep the number of the users in that group. Basically i want everytime i am saving a user to recalculate the users in all usergroups. I am trying to have something like:SELECT User_GroupId, count(User_GroupId) as UsersCount FROM tblUsersWHERE DeletedFlag = 0 GROUP BY User_GroupId and then:"FOR EACH" User_GroupIdUPDAT...

how to transfer the data from table A to table B OR FROM EXCEL TO TABLE I NEED
Hi all,I am trying to transfer the data in the excel file to the SQL 2005 database .i am able to transfer the data into database, but into new table the table i need.can anybody help to transfer the whole data from the excel to the table i need or from one table to another.i would appreciate if anyone can help. TABLE A -----> TABLE BOREXCEL -----> TABLE I NEEDOR EXCEL ---->TABLE A -----> TABLE B  CheersDivikiran   right click database, select tasks-> import/export data ( depends on your requirements) select source and destination. (if from excel to ...

SQL: Moving a row from one table to another.
List, I would like to be able to move a row from one table to another table within the same database. Off the top of my head I suppose the SQL command would look similar to the following... my $sql = 'MOVE * FROM table1 WHERE unique_id = '1111' TO table2'. FINISH Then I would like to be able to do the following as well... my $sql = 'INSERT INTO table2 (crud, crud, crid) VALUES ('crud', 'crud', 'crud')' FINISH The second is possbile :) Is the first possible? Thanks in advance.. Regards, Daniel Falkenberg I'v...

Copy values from one table to another table using LINQ to SQL?
Hello,I have two database tables that have different names but identical structure (columns).What is the easiest way to copy the values from one table to the other table using LINQ to SQL? Thanks,-- shawn shawn Hi, As far as I research, we could use "foreach"  to insert the data from one table to another table. The code is shown below.         //there exist two table list and listSecond        DataClassesDataContext dataClass = new DataClassesDataContext(); //create the instance of the DataCon...

Record from one table, calcs on each row of another table
Imagine two tables. Table 1 has various tombstone information, including Latitude and Longitude. Table 2 has a bunch of locations, each with a latitude and longitude. I've created a class for various geomaths; in this case, distance between two GPS coords, and bearing from point A to point B.  Set startlat, startlong, endlat, endlong, and read distance and bearing properties, the class does the maths.  So, what I want to do is read a record from Table 1; this record is displayed, at the moment, in a DetailsView. I want to read each record from table 2, calculate the distan...

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...

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...

Transfer data from one Table to another T-sql
I need to transfer data from one table to another.I will be using the SQL Query Analyzer to do this.This is not a simple transfer of data to the same structured tables.These tables are completely different, for the most part.For instance, I will be selecting certain fields of one table.....SELECT fldOne, fldTwo FROM someTableI need to take this information, one row at a time and input it into a different type table.So, something like this to insert into the other table...INSERT INTO otherTable( fld1, fld2) VALUES( value1, value2 )I've looked around for a sample to achieve this, but...

Inserting distinct data from one table in another table, how?!?Really urgent and needing help!!!
 Hi, I have a table in which I will insert several redundant data. Don't ask why, is Integration services, it only reads data and inserts it in a SQL table. THis way, I have a SQL table with several lines repeating them selves. What I want to do is create a procedure that reads the distinct data and inserts it in another table, but my problem is that I am not able to select data line by line on the original table to save it in local variables and insert it on the another table, I just can select the last line. I've tried a while cycle but no succeed. Here is my code: create...

Web resources about - Need to transfer certain rows from one table into another table - asp.net.sql-datasource

Charge-transfer complex - Wikipedia, the free encyclopedia
A charge-transfer complex ( CT complex ) or electron-donor-acceptor complex is an association of two or more molecules , or of different parts ...

Netgear accidentally published a guide showing its customers how to transfer pirated movies
Computer hardware maker Netgear has accidentally published a guide on its website that teaches users how to transfer illegal pirate movies to ...

All I Want for Christmas: A File-Transfer Wish List
Here's a holiday wish list for what IT professionals are longing for when it comes to secure, timely file transfers to colleagues or customers. ...

Cristiano Ronaldo Linked To Manchester City Transfer Again, City Players Confident Of Move
Cristiano Ronaldo has once again been linked to a transfer away from Real Madrid, and this time it has been alleged that Manchester City are ...

Transfer Your Notes from Evernote to Apple Notes with This Script
Ready to leave Evernote and move your notes to iCloud? This free Applescript is the quick and easy way to transfer your notes to Apple Notes. ...

Groundbreaking light-based photonic processor could lead to ultra-fast data transfers
University researchers are claiming a bandwidth breakthrough with the first light-based microprocessor that communicates with conventional electronic ...


4 Balance Transfer Credit Cards to Consider for 2016
Want to pay off your debt once and for all? Sign up for one of these cards.

Data transfer reaches new heights at supercomputing conference
Transferring data files may seem a routine task to some, but to researchers, it's a task that becomes arduous when large amounts of computational ...

Jose Mourinho agrees five-year deal to become new Man United manager - Football - Premier League Transfer ...
JOSE MOURINHO has agreed a five-year deal to become the new Manchester United boss, according to...

Resources last updated: 12/27/2015 12:04:49 AM