'How can i combine the values from 3 varchar columns to one column? [duplicate]
For Example
I have the following Columns in a DB-table: Name, Surname, Adress, Contact. In one row the value for the column name is Smith , the surname Bob and the adress Street1.
How can i combine the mentioned values to the column Contact? The Value in this row should be like this then: Bob_Smith_Street1
I want this to be automatically created in the table. so as soon as I right click on the Table -->select 1000 rows, the value is displayed. Without having me to enter the mentioned select command. Is this possible? Can anything be done when creating the table for this. So for example create table employees (Contact(name""surname""address)).
thanks
ps. sorry for my bad english:)
Solution 1:[1]
Use CONCAT(). For example:
select concat(Name, '_', Surname, '_', Adress) as contact from t
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | The Impaler |
