ShootingBlanks Posted September 24, 2007 Share Posted September 24, 2007 Hello. This is probably pretty easy, but I'm not sure how to do this because I've only used phpMyAdmin and not hand-coded SQL... I just used phpMyAdmin to add a new column/header to a table that has about 150 different records in it. Right now, the column is obviously blank for each entry. Is there a way to bulk-fill-in all the fields in my new column to read "2"? The only way I know how to do it is to manually update each record by selecting it in phpMyAdmin and then editing it... Thanks!... Quote Link to comment https://forums.phpfreaks.com/topic/70496-solved-easy-sql-update-question/ Share on other sites More sharing options...
recklessgeneral Posted September 24, 2007 Share Posted September 24, 2007 Hi, The SQL query you'll need is UPDATE mytable SET new_field = '2' where mytable and new_field are the names of your table and column respectively. You can run this in phpMyAdmin by clicking the SQL tab for the selected table. Just type the statement above into the text box and hit go. PhpMyAdmin will then run the query and notify you of how many rows were updated. An easier way to do this in future is to set the default value to 2 when you add a new column to your table. Cheers, Darren. Quote Link to comment https://forums.phpfreaks.com/topic/70496-solved-easy-sql-update-question/#findComment-354212 Share on other sites More sharing options...
ShootingBlanks Posted September 24, 2007 Author Share Posted September 24, 2007 Thanks so much!!! Quote Link to comment https://forums.phpfreaks.com/topic/70496-solved-easy-sql-update-question/#findComment-354228 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.