Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is this SQL statement not executing?

Tags:

sql

I have an SQL statement without a where clause because I want it to affect all rows. I have a column with the name url. Now I want to change the current column url to something else. I want to concatenate something to the current url.

My statement is:

 UPDATE tablename SET url = 'http' || url;

This is in a sql file, which executes and throws no errors but the database is not changing.

Can anyone help?

RDBMS is MySQL

like image 449
user953278 Avatar asked Mar 05 '26 01:03

user953278


1 Answers

Depending on your engine (in case it isn't Oracle and you have some bizarre MySQL bitwise operator)

UPDATE tablename SET url = CONCAT('http', url);

or

UPDATE tablename SET url = 'http' + url;
like image 159
gbn Avatar answered Mar 07 '26 18:03

gbn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!