dyluck Posted August 9, 2010 Share Posted August 9, 2010 Hi there, Does anyone have a sql query to replace a piece of string? I have many rows in a column with various filenames like blaa.gz baaaa.gz etc. I need to find the .gz and replace with .zip Is that possible in a mysql query? Thanks, dyluck Link to comment https://forums.phpfreaks.com/topic/210178-partial-string-replace/ Share on other sites More sharing options...
JasonLewis Posted August 9, 2010 Share Posted August 9, 2010 Yeah, should be, using REPLACE. UPDATE tablename SET fieldname = REPLACE(fieldname, '.gz', '.zip') WHERE idfield='1' Link to comment https://forums.phpfreaks.com/topic/210178-partial-string-replace/#findComment-1096854 Share on other sites More sharing options...
dyluck Posted August 9, 2010 Author Share Posted August 9, 2010 Worked like a charm! thanks! Link to comment https://forums.phpfreaks.com/topic/210178-partial-string-replace/#findComment-1096857 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.