I want to populate data in a column from different columns based on some criteria for example, I have a table:
MyTable( id, area_id, name )
with sample data:
10 1 <name>
20 2 <name>
30 3 <name>
40 4 <name>
50 1 <name>
60 2 <name>
70 3 <name>
80 4 <name>
Now I want this table to be updated as
10 1 Area 1
20 2 Area 2
30 3 Area 3
40 4 Area 4
50 1 Area 1
60 2 Area 2
70 3 Area 3
80 4 Area 4
How to achieve this in a single query.
Since column
namealready exist, do update with the use ofCONCATIf you want to add another column, please read the article