Monday, 15 April 2013

mysql - sql query to replace city pune to mumbai and mumbai to pune in the table -



mysql - sql query to replace city pune to mumbai and mumbai to pune in the table -

i have 1 table emp column name city

city output table ----- bombay pune pune bombay mumbai pune pune bombay pune bombay

i want update query replace pune bombay , bombay pune

you can query:

select (case when city = 'mumbai' 'pune' when city = 'pune' 'mumbai' else city end) . . .

if want alter values, then:

update table t set city = (case when city = 'mumbai' 'pune' when city = 'pune' 'mumbai' end) city in ('mumbai', 'pune');

mysql sql

No comments:

Post a Comment