E
E
Evgeny Shevtsov2015-02-04 16:31:35
MySQL
Evgeny Shevtsov, 2015-02-04 16:31:35

How to remove a specific sql value from a string?

There is a selection
SELECT * FROM `alias` WHERE `keyword` like '%.html'
How do I remove the ending '.html' from all rows in the keyword column

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Shevtsov, 2015-02-04
@Rattlesneyk

I did this
UPDATE `alias` SET `keyword` = REPLACE( `keyword` , '.html', '' ) WHERE `keyword` LIKE '%.html'

A
Armenian Radio, 2015-02-04
@gbg

Use substr to strip off the last 5 characters.
Something likeupdate 'alias' set keyword=substr(keyword,0,-5)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question