brown2005 Posted April 12, 2006 Share Posted April 12, 2006 Hi,I have:-INSERT INTO table2 (letter) SELECT letter FROM table1 ORDER BY RAND()which takes 26 records from table1 and inserts them into the letter field of table 2but how can iupdate exsisting records in table2 and not insert? Quote Link to comment https://forums.phpfreaks.com/topic/7184-update/ Share on other sites More sharing options...
shocker-z Posted April 12, 2006 Share Posted April 12, 2006 i *think* this will workUPDATE table2 SET `fieldname` = (SELECT letter FROM table1 ORDER BY RAND())but i'm not 100 % on it Quote Link to comment https://forums.phpfreaks.com/topic/7184-update/#findComment-26149 Share on other sites More sharing options...
wildteen88 Posted April 12, 2006 Share Posted April 12, 2006 Have a look at SELECT INTO [a href=\"http://www.w3schools.com/sql/sql_select_into.asp\" target=\"_blank\"]here[/a] Quote Link to comment https://forums.phpfreaks.com/topic/7184-update/#findComment-26154 Share on other sites More sharing options...
brown2005 Posted April 12, 2006 Author Share Posted April 12, 2006 i dont think select into is really what i want, but i might be wrong, as far as i can see that just creates a new table, but i dont want a new table.the () in the query hasnt worked.. any other ideas please? Quote Link to comment https://forums.phpfreaks.com/topic/7184-update/#findComment-26161 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.