thomasw_lrd Posted September 21, 2011 Share Posted September 21, 2011 I am currently working on a very large project for my job. We have four databases on one server that are identical except for the data contained within. We have a web front end written in php. The menu for the front end is dynamically created by a table in the database. I need to update this table (tbl_menu_items) on 3 of the databases with the data from our development database. I know I can use Update to do this, but I was wondering if it was possible to use wildcards, rather than have to spell out each column in the database. I've been googling all day, and I know I can spell out each column that needs to be updated. Something similar to this below? UPDATE items,month SET items.*=month.* WHERE items.id=month.id; Quote Link to comment https://forums.phpfreaks.com/topic/247607-updating-multiple-columns-with-wildcards/ Share on other sites More sharing options...
requinix Posted September 21, 2011 Share Posted September 21, 2011 Strictly an update? Or could you drop all the data and insert everything anew? Quote Link to comment https://forums.phpfreaks.com/topic/247607-updating-multiple-columns-with-wildcards/#findComment-1271509 Share on other sites More sharing options...
fenway Posted September 21, 2011 Share Posted September 21, 2011 That's just lazy -- that's what loops are for. In the time you spent "googling all day", you could have been done 30 times. Quote Link to comment https://forums.phpfreaks.com/topic/247607-updating-multiple-columns-with-wildcards/#findComment-1271539 Share on other sites More sharing options...
mikosiko Posted September 21, 2011 Share Posted September 21, 2011 ^^+1 and if you have the privileges to query the INFORMATION_SCHEMA table a simple query could do the "hard" job to spell the columns for you... ready to just copy and paste..... Quote Link to comment https://forums.phpfreaks.com/topic/247607-updating-multiple-columns-with-wildcards/#findComment-1271545 Share on other sites More sharing options...
fenway Posted September 21, 2011 Share Posted September 21, 2011 DESCRIBE will work too, pre v5. Quote Link to comment https://forums.phpfreaks.com/topic/247607-updating-multiple-columns-with-wildcards/#findComment-1271548 Share on other sites More sharing options...
thomasw_lrd Posted September 21, 2011 Author Share Posted September 21, 2011 All good ideas. I actually wrote an update query that should have worked, but I don't have shell access, only mysqladmin (which sucks btw). I'll probably just have to delete the data, and insert it again. Not my preffered way to work, but sometimes you've got to do what you've got to do. Quote Link to comment https://forums.phpfreaks.com/topic/247607-updating-multiple-columns-with-wildcards/#findComment-1271594 Share on other sites More sharing options...
Muddy_Funster Posted September 22, 2011 Share Posted September 22, 2011 All good ideas. I actually wrote an update query that should have worked, but I don't have shell access, only mysqladmin (which sucks btw). I'll probably just have to delete the data, and insert it again. Not my preffered way to work, but sometimes you've got to do what you've got to do. good lad It's attitudes like that that get people like me so many contracts Quote Link to comment https://forums.phpfreaks.com/topic/247607-updating-multiple-columns-with-wildcards/#findComment-1271706 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.