Mysql string replace
Ott.05, 2012 in
Computers, Programmazione
, Ecco la query fichissima che mi ha salvato la vita:
UPDATE fatture SET rifInt = CONCAT( SUBSTRING_INDEX(rifInt, '/', -1), '/', SUBSTRING_INDEX(rifInt, '/', 1) ) WHERE rifInt != ''
In pratica nella tabella “fatture” avevo un campo chiamato “rifInt” che era stato compilato al contrario: numero/data al posto di data/numero. Con questa query ho potuto invertire e salvare i campi in un attimo!
Rispondi