SQL Combine Two Columns in Select Statement

前端 未结 5 1549
栀梦
栀梦 2020-12-03 10:23

If I have a column that is Address1 and Address2 in my database, how do I combine those columns so that I could perform operations on it only in my select statement, I will

5条回答
  •  星月不相逢
    2020-12-03 10:48

    SELECT StaffId,(Title+''+FirstName+''+LastName) AS FullName 
    FROM StaffInformation
    

    Where do you write with in the brackets this will be appear in the one single column. Where do you want a dot into the middle of the Title and First Name write syntax below,

    SELECT StaffId,(Title+'.'+FirstName+''+LastName) AS FullName 
    FROM StaffInformation
    

    These syntax works with MS SQL Server 2008 R2 Express Edition.

提交回复
热议问题