Jump to content

how to replace value in whole database.


zohab

Recommended Posts

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?

 

Link to comment
https://forums.phpfreaks.com/topic/143741-how-to-replace-value-in-whole-database/
Share on other sites

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)

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.