I have a question, I'm trying to update all rows in our database that have domains like this http://yahoo.com I want to add www. after the http:// for example all my domains should say http://www.domainname.com I'm trying to update the ones that are missing the www. before the host name. Any one know the sql for this?
You could do it in two steps using REPLACE(). First, do SET domains = REPLACE(domains,'http://','http://www.') to make sure that all of them start with at least one www (but check if you need to escape out any of the special characters - I can't remember). Then filter out the ones that already had one with SET domains = REPLACE(domains,'http://www.www.','http://www.')