mardi 6 juin 2017

how to update a column by combining two column values into one column in MySQL using laravel

I want to update my existing column with concatenating two columns in a table using laravel migrations.

An example: I am having a column FIRSTNAME and LASTNAME and so many columns also. I want to concatenate these two columns with the name of FIRSTNAME only in between space.

So this is how it works in mysql:

SELECT CONCAT(FIRSTNAME, ' ', LASTNAME) AS 'FIRSTNAME' FROM customer;

How we have to do this using laravel?

Right now Firstnames are displayed in one column and lastnames are displayed in another column. I have to update both the values into single column by concatenating.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire