sql - Combining multiple text fields into one in MySQL -


I have a list of users in the table, with different fields for first, middle and last names. For various reasons, I have to change the database structure as if there is only one "name" field 3 What is the best / easiest way to migrate your data to a new area from the old areas?

Add a column first which is more than all 3 combined.

  Changing table tbl full name varchar (100); After this, update it with an announction of the old column.  
  update tbl set fullname = concat (lastname, ',', firstname, ''  << pre> 

(This ends in 'Kirk, John M'

Then, delete the old columns

  change the table TLL drop column first; change the table TLL drop column midlink; replace the table TBL drop column last name; < / Code>   

Comments