Useful mysql to remove / in a db column

Here is a handy sql statement for removing a trailing ‘/’ in the column url

     UPDATE websites
     SET url = LEFT(url, LENGTH(url) - 1)
     WHERE RIGHT(url, 1) = '/'

Leave a reply:

Your email address will not be published.

Site Footer

Sliding Sidebar

Subscribe for updates

Enter your email address to subscribe to receive notifications of new content by email.

Join 5,742 other subscribers