SQL Server将两个字段数据合并成一个字段显示(字段与字段添加特殊符号)减号 中括号 小括号
--用中括号实现两个字段组合成一个并显示
select Phone as 手机号,
(CAST(Name as varchar(20))+'['+ CAST (ShopNo as varchar(20))+']')
as 姓名工号
From Shopping (NOLOCK) t order by CreateDate desc
--用括号实现两个字段组合成一个并显示
select Phone as 手机号,
(CAST(Name as varchar(20))+'('+ CAST (ShopNo as varchar(20))+')')
as 姓名工号
From Shopping (NOLOCK) t order by CreateDate desc
--用减号实现两个字段组合成一个并显示
select Phone as 手机号,
(CAST(Name as varchar(20))+'-'+ CAST (ShopNo as varchar(20)))
as 姓名工号
From Shopping (NOLOCK) t order by CreateDate desc