【发布时间】:2017-03-20 10:29:50
【问题描述】:
我想将几列连接在一起,并在考虑NULL 值的情况下用换行符分隔每列返回。
比如我有如下数据表([dbo].[Address]):
Name Address_line1 Address_line2 Address_line 3 Postcode
Mr Smith 1 Smith Street NULL Ireland AB1 1CD
Mr Jones 1 Jones Road Wales NULL EF2 3GH
Mrs White 1 White Way England UK NULL
我想返回以下内容:
Name Address
Mr Smith 1 Smith Street,
Ireland,
AB1 1CD
Mr Jones 1 Jones Road,
Wales,
EF2 3GH
Mrs White 1 White Way,
England,
UK
我该怎么做?
【问题讨论】:
-
你可以在表现层处理这个
标签: sql sql-server concatenation