SQL statement to remove part of a string

Viewed 83268

Possible Duplicate:
str_replace in SQL UPDATE?
How to remove part of string in mysql?
SQL Find & Replace part of a string

I have a database table with a list of website urls e.g. http://website.com/ and I want to remove all the http:// and https:// from them. Is their a simple SQL statement I could run on a column to remove it?

I've had a search around, but I can't find what I need. I'm presuming I need to use both REPLACE and UPDATE but I'm struggling.

So far I have:

UPDATE list
SET    website
WHERE  website LIKE 'http://%';

Is that correct? I'm using MySQL and the table is list, and column is website and I want to remove the http:// so a url like: http://website.com/ becomes just: website.com

EDIT: Is it also possible to remove a trailing slash as well?

3 Answers
Related