If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > insert into a table from another table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-16-04, 04:42
laals laals is offline
Registered User
 
Join Date: Jul 2004
Posts: 13
insert into a table from another table

hi all..

i'm new in sql and also very poor
i need the sql syntax for inserting into a table from another table both having same structure
pls help
Reply With Quote
  #2 (permalink)  
Old 09-16-04, 07:26
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
insert into table2 (col1, col2, col3)
select col1, col2, col3 from table1;

If the columns are in the same order in both tables then this shorthand will work:

insert into table2
select * from table1;
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 09-16-04, 08:48
laals laals is offline
Registered User
 
Join Date: Jul 2004
Posts: 13
Smile thank u

thank u andrews thank u very much
i got it
Lals
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On