Search code examples
mysqlsqlstring-concatenation

SQL: How to connect function to a string


Is there any way to connect function to a string?

Like this:

UPDATE table SET col = 'MYSTRING' . SUBSTRING_INDEX(col, ':', 2)

Thanks in advance.


Solution

  • Are you looking for concat()?

    UPDATE table
        SET col = CONCAT('MYSTRING', SUBSTRING_INDEX(col, ':', 2));