concatenate two database columns into one resultset column

后端 未结 7 2224
独厮守ぢ
独厮守ぢ 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 you were using SQL 2012 or above you could use the CONCAT function:

    SELECT CONCAT(field1, field2, field3) FROM table1
    

    NULL fields won't break your concatenation.

    @bummi - Thanks for the comment - edited my answer to correspond to it.

提交回复
热议问题