Need Mysql Help

liunx

Guest
the first problem was two different structured databases that I need to copy the info from the table users into another database table user.<br /><br />I managed to copy the whole thing to the new database with a new table named users so I need to convert it to the table user.<br />User has name Users has fname and lname<br />How do I go about inserting the fname and lname into another table called sname. Bear in mind that I need a space after fname.<br /><br />I think it would be with the insert command but I can't seem to figure out the proper terms.<br /><br />Any Help will be greatly appreciated.<br /><br />Thanks<br />Cindy<br />The Blue Unicorn<!--content-->
Welcome to the forums Cindy <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br />Maybe <a href="http://www.tizag.com/mysqlTutorial/mysqlinsert.php" target="_blank">this tutorial</a> will help get you started.<!--content-->
Welcome to the forums Cindy <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> <br /><br />Did you manage to get it sorted ?<!--content-->
Welcome to the forum, Cindy. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
INSERT INTO <i>tablename</i> (fieldname1, fieldname2, fieldname3) VALUES (value1, value2, value3)<br /><br />You can make it shorter if you know the order of your fields in which case you can drop the field names.<!--content-->
Welcome to the forums Cindy <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->INSERT INTO User(name) SELECT CONCAT(fname, ' ', lname) AS old_names FROM Users;<!--c2--></div><!--ec2--><br /><br />That's just off the top of my head so there is likely an error or two in it.<!--content-->
 
Back
Top