Skip to content
Advertisement

How to merge 2 cells to generate a new value/text in an empty column cell?

I have a table with columns: firstName, lastName and emailAddress

firstName and lastName are populated with values but emailAddress column is empty. How do I generate and insert an email address for each person by combining their first and last names?

Advertisement

Answer

if the rows are already inserted the you could use update

assuming that email Address is based on a pattern like firstName.lastName@domain.country

update my_table  
set emailAddress = concat(firstName, '.',lastName,'@', 'yourdomanin.xyz')
;
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement