Jim R Posted December 28, 2019 Share Posted December 28, 2019 Here are my examples: City | School Bloomington | Bloomington North Columbus | Columbus East Fort Wayne | Fort Wayne Bishop Dwenger I have several of these. I want to remove from School what already is in City. Quote Link to comment https://forums.phpfreaks.com/topic/309759-removing-part-of-a-column-via-update-or-trim/ Share on other sites More sharing options...
Barand Posted December 28, 2019 Share Posted December 28, 2019 SELECT school , city , TRIM(REPLACE(school, city, '')) as new_school FROM school; Quote Link to comment https://forums.phpfreaks.com/topic/309759-removing-part-of-a-column-via-update-or-trim/#findComment-1572926 Share on other sites More sharing options...
Jim R Posted December 28, 2019 Author Share Posted December 28, 2019 I should've said, not every row has that. The ones which don't are either NULL or a different city altogether. Quote Link to comment https://forums.phpfreaks.com/topic/309759-removing-part-of-a-column-via-update-or-trim/#findComment-1572936 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.