Reputation: 343
I just started learning SQL so I'm not that adept at it yet and I wasn't really sure how to do my research on this one because I couldn't word the question properly so I decided to ask a question for myself.
Alright, so here's what I'm trying to do in my particular case: I use Microsoft Access 2010. In my table called "MEMBERS" I have a field called "Address". The entries in this column are really messy so I'm trying to tidy it up. Some of the entries contain 'Road' while others contain 'Rd'. What I want to do is update the columns that have 'Road' in them and change that word only to 'Rd' without affecting the rest of the address.
So if one of the entries were '7 Example Road' I would like to create a query to change it to '7 Example Rd'.
This is the query I tried to use:
UPDATE MEMBERS
SET 'Rd'
WHERE Address LIKE '*Road'
Any help would be greatly appreciated!
Upvotes: 6
Views: 11726
Reputation: 1035
Try using REPLACE()
function.
UPDATE MEMBERS
SET Address = REPLACE(Address, 'Road', 'Rd')
WHERE Address LIKE '*Road'
Upvotes: 9