November 9, 2012 at 6:25 am
Hi friend i have small doubt in sql plz how to solve this one.
1)insert the data from one table to another table that time we write query like
select * into (new table name) from (existing table name)
like this way how to inssert multiple table data into one table .how we wirte query
acutal i have 2 table data like 1st table abc id,name,sal andother table xyz id,location
1,add,100 1, hyd
2,rav,2500 2,chen
3,be,3600 7,pune
10,mumbai
i comine this table to write query
select * from abc full join xyz on abc.id=xyz.id
this time all records retrive on both table.
this all data load into another new table. how we write query plz tell me
new table create while we write one table data into aonther table like this way to write multiple table data into new table
plz tell how to wirte query
November 9, 2012 at 6:29 am
Does the table you want to insert the data into already exist, or are you creating it from the Select query?
If it already exists, add the correct Insert statement before the Select statement.
INSERT INTO dbo.MyTable (list of columns)
SELECT list of columns
FROM dbo.MyOtherTable AS T1
INNER JOIN dbo.MyThirdTable AS T2
ON join criteria for T1 to T2;
If the table needs to be created, add INTO and the table name after the SELECT, before the FROM.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply