Query to erase a href hyperlink

Hi guys,

I would be eternally grateful if someone could help me put together a query here, or whether this is possible or not.

I have many links throughout my database site like this:

<a href="http://www.youtube.com/watch?v=8mqmKmeqBw4">http://www.youtube.com/watch?v=8mqmKmeqBw4</a>

I want to remove the hyperlink completely but keep the link text so I end up with:

http://www.youtube.com/watch?v=8mqmKmeqBw4

The URL video codes are all different throughout the site but they are all from youtube.

Anyone any ideas?

Many thanks in advance!

Hi Guelphdad, thank you kindly for your suggestion.
If I run a replace on </a> it will also erase other links in my content?

I think it should but, if you store data consistently, then you can use your language of choice, to add the html hyperlink tags in your app.

For me that would make db management easier due to consistent storage of links.

hth

bazz

First i’d run an update to remove the </a> tags. Then you can use SUBSTRING_INDEX and split your column on the > tag and retrieve only the part that comes after it. You can either create a new column and run an update to put the part you want there, or run the update in the existing column.

Back up your data first.