I am having really short query for MariaDB to fix broken links to twitter.
Table users has link_twitter as VARCHAR(255), to generate DB schema we are using PHP Doctrine, but I want to run this query manually.
The server is running MariaDB 1.10
The query:
UPDATE
`user` AS u
SET
u.link_twitter = "https://twitter.com/" + u.link_twitter
WHERE
u.link_twitter NOT LIKE 'https://twitter.com/%';
But I am getting the 'Query Error: (1292): Truncated incorrect DOUBLE value: 'https://twitter.com/' '
I know, that this question was asked a lot in the past but none of the solutions worked for me. :-(
Please, how can I fix it?
Thanks
Use the proper string concatenation method:
UPDATE user u
SET u.link_twitter = CONCAT('https://twitter.com/', u.link_twitter)
WHERE u.link_twitter NOT LIKE 'https://twitter.com/%';
+
means addition in MariaDB/MySQL (and most databases). Hence it tries to treat its arguments as numbers.