Hi Suzanne,
 
 When you say:
 insert into table_2 select * from table_1
 alls fine. All the records and fields will get
 copied.
 
 But when you say: 
 insert into table_2 select fieldname_1 from table_1
 
 you are just selecting fieldname_1 from table_1
 while
 table_2 consists of fieldname_2 also.
 
 So the correct sql statement will be:
 insert into table_2(fieldname_1) select fieldname_1
 from table_1;
 
 The fieldname_2 will get its default value and if it
 is an autoincrement field then the value will be
 incremented and auotmatically inserted.
 
 Hope this will clear your doubt.
 
 -Sagar A. Tamhane



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to