zohab Posted February 4, 2009 Share Posted February 4, 2009 hi all, if i want to update table with new value i will do as update table set id='4' where id='3' this will replace id='3' to id='4' table id name 1 name1 2 name2 3 name3 but if i want to replace it in whole database ,how will i do it. table 1 id name 1 name1 2 name2 3 name3 table 2 id name 1 name1 2 name2 3 name3 table 3 id name 1 name1 2 name2 3 name3 any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/143741-how-to-replace-value-in-whole-database/ Share on other sites More sharing options...
trq Posted February 4, 2009 Share Posted February 4, 2009 Why would you have three different tables storing what appears to be the same information? You will need to use 3 seperate queries. Quote Link to comment https://forums.phpfreaks.com/topic/143741-how-to-replace-value-in-whole-database/#findComment-754179 Share on other sites More sharing options...
zohab Posted February 4, 2009 Author Share Posted February 4, 2009 hi thorpe , I have 100 tables in my database and i want to replace 'xyz' to 'pqr' I am not able to do it for every table.For this i have to write 100 queries. i want to run one small query that will replace 'xyz' to 'pqr' in whole database (includes 100 tables) Quote Link to comment https://forums.phpfreaks.com/topic/143741-how-to-replace-value-in-whole-database/#findComment-754194 Share on other sites More sharing options...
peddel Posted February 4, 2009 Share Posted February 4, 2009 hi thorpe , I have 100 tables in my database and i want to replace 'xyz' to 'pqr' I am not able to do it for every table.For this i have to write 100 queries. i want to run one query that will replace 'xyz' to 'pqr' in whole database (includes 100 tables) First create a VIEW by using a UNION between all the 100 tables Then maken 1 query on that VIEW Usefull info : http://dev.mysql.com/doc/refman/5.0/en/create-view.html http://dev.mysql.com/doc/refman/5.0/en/union.html Quote Link to comment https://forums.phpfreaks.com/topic/143741-how-to-replace-value-in-whole-database/#findComment-754196 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.