0

I'd like a bit of help please with an SQL command

I have some text and I need to add and an extension to the end of the string on anything.

I've tried this but it doesn't work the way I want it to:

UPDATE table1 SET column1  = '%TEST%' WHERE 'column1' LIKE '%TEST%' + '.exe'

as the output I'd like is

TEST1.exe
TEST2.exe
TEST3.exe
1

1 Answer 1

2

You need to use CONCAT to add to the string, and your UPDATE syntax isn't quite right. This should work:

UPDATE table1
SET column1 = CONCAT(column1, '.exe')
WHERE column1 LIKE '%TEST%'
Sign up to request clarification or add additional context in comments.

8 Comments

looking into the mysql databse its added it outside the [ ] is there anyway to get it inside the [ ] ["TEST1"].exe
@DanielPeters can you show me some sample data - the data in your question doesn't have any [] around it...
["http:\/\/URL1\/1"]
@DanielPeters I presume you want to end up with ["http://URL1/1.exe"]? What version of MySQL are you running?
msql 5.7.26 the url displays like that in phpmyadmin i think it would need to end up as ["http:\/\/URL1\/1.exe"]
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.