Wildhalf Posted February 12, 2010 Share Posted February 12, 2010 Hi Anyone know the SQL i could use to remove a number (which is on the right hand side of string) from every entry in my table (wp_terms) in the name colum??? example 1: Dry Cleaning2 example 2: Travel2 I have over 700 to do so would be hard manually thanks Quote Link to comment https://forums.phpfreaks.com/topic/191865-remove-a-number-form-every-element-ina-colum/ Share on other sites More sharing options...
Wildhalf Posted February 12, 2010 Author Share Posted February 12, 2010 Sorted it out myself used UPDATE `TABLE_NAME` SET `COLLUM_NAME` = REPLACE(`COLLUM_NAME`, 'VALUE_TO_CHANGE', '') Quote Link to comment https://forums.phpfreaks.com/topic/191865-remove-a-number-form-every-element-ina-colum/#findComment-1011297 Share on other sites More sharing options...
kickstart Posted February 12, 2010 Share Posted February 12, 2010 Hi Is it always a single digit numeric, and does it apply to all rows? If so then UPDATE TableName SET ColumnName = SUBSTR(ColumnName,1,LENGTH(ColumnName) -1) All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/191865-remove-a-number-form-every-element-ina-colum/#findComment-1011298 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.