In
this article I am going to explain how to combine 2 or more columns into one
column in SQL server.
In
the previous article I have explained Show and hide on dropdown selection usingJquery, how to calculate total number of days between two dates in asp.net and howto show and hide the div on button click using Jquery.
Description:
I
have created a table for Users and insert some records.
ID
|
int
|
Firstname
|
varchar(50)
|
Middlename
|
varchar(50)
|
Lastname
|
varchar(50)
|
Phonenumber
|
int
|
City
|
varchar(50)
|
I
want to concatenate (combine) first, middle and last into one column.
Implementation:
Run
the below given query:
select Firstname+' '+Middlename+' '+Lastname as 'Name',Phonenumber,City from Users
Result:
Name
|
Phonenumber
|
City
|
Vijay
Kumar saklani
|
123456789
|
Chandigarh
|
John Smith
Smith
|
876543
|
London
|
0 Comments