Home > Mobile >  phpmyadmin combine text and column in SET SQL
phpmyadmin combine text and column in SET SQL

Time:09-23

I'm trying to use the existing values in columns to create a new column using phpmyadmin.

I currently have the following database.

| First_Name | Second_Name    | Full_Name |
| ---------- | -------------- | --------- |
| Paul       | Smith          |           |
| Mike       | Wazowski       |           |

...

I have first names and second names, but I'm wanting to insert data into full name with some text. I have used this command below to insert data:

UPDATE `users` SET `Full _Name`='some text'   `First_Name`;

However that returns the problem Truncated incorrect DOUBLE value.

CodePudding user response:

That should work:

UPDATE users SET Full_Name = CONCAT(First_Name," ",Second_name)

https://www.w3schools.com/Sql/func_mysql_concat.asp

  • Related