Sql Question [message #19848] |
Sat, 13 April 2002 06:44 |
Pradeep
Messages: 55 Registered: July 2000
|
Member |
|
|
Hi all,
I have a table and i want to insert all the data of a second table into the first one, how can it be done ? Both the tables have the same structure. how that could be done using single sql-statement, somehow i am not able to do it.
If anybody knows then please tell me ..
Thanks,
Prads
|
|
|
|
Re: Sql Question [message #19858 is a reply to message #19848] |
Sat, 13 April 2002 18:08 |
ADEOYE SOLARIN
Messages: 2 Registered: April 2002
|
Junior Member |
|
|
Since the structure of the tables are the same and the tables are identical however you can use a single select statement like this.It's called a subselect method.At the sql prompt type;
INSERT INTO TABLE
SELECT*
FROM TABLE1
WHERE (CONDITION);
NOTE THAT THE FIRST TABLE UP IS YOUR NEW TABLE (TABLE TO BE CREATED)
TABLE1 IS YOUR EXISTING TABLE (TABLE TO BE COPIED FROM)
WHERE IS THE CONDITION YOU WANT TO SPECIFY TO THE ACTUAL RESULT.
I HOPE THIS WILL SOLVE YOUR PROBLEM.IF NOT GET BACK TO ME.
|
|
|