concatenate two database columns into one resultset column

后端 未结 7 2219
独厮守ぢ
独厮守ぢ 2020-11-28 10:00

I use the following SQL to concatenate several database columns from one table into one column in the result set:

SELECT (field1 + \'\' + field2 + \'\' + field

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-28 10:06

    If both Column are numeric Then Use This code

    Just Cast Column As Varchar(Size)

    Example:

    Select (Cast(Col1 as Varchar(20)) + '-' + Cast(Col2 as Varchar(20))) As Col3 from Table
    

提交回复
热议问题