Trey Copeland
Trey Copeland

Reputation: 3527

How to remove double slashes from column in MySQL?

I have recently found a bug in my website that has been inserting an extra backslash in the URL. I have fixed the bug, but would like to clean up my historical data.

My table name is visits and column name is url. Some of the example URLs in the field are:

www.mysite.com//
www.mysite.com//restaurant/mcdonalds/
www.example.com//

How can I do a find and replace on // to change it to / in MySQL?

I would greatly appreciate any help. Thanks!

Upvotes: 2

Views: 816

Answers (1)

Brian Efting
Brian Efting

Reputation: 46

update visits set url=replace(url, '//', '/');

Upvotes: 3

Related Questions