如何选择所有列为1列?

时间:2016-06-26 14:58:03

标签: sql

如何使用' - '在单列中获得如下结果?分开: -

详情

AAAA-A-11111

此处 - 详细信息是列名

Create Table Users1
(
FName varchar (50),
LName Varchar (50),
Number varchar(10),
CreateDate Datetime
)    

INSERT INTO Users1 Values ('AAAA','A','11111','06-25-2016 00:10')
INSERT INTO Users1 Values ('BBBB','B','22222','06-25-2016 01:18:000')
INSERT INTO Users1 Values ('CCCC','C','33333','06-25-2016 06:10:000')
INSERT INTO Users1 Values ('DDDD','D','44444','06-25-2016 06:10:000')
INSERT INTO Users1 Values ('EEEE','E','55555','06-25-2016 23:10:000')
INSERT INTO Users1 Values ('FFFF','F','66666','06-25-2016 00:01:000')
INSERT INTO Users1 Values ('FFFF','G','77777','06-26-2016 00:01:000')
INSERT INTO Users1 Values ('FFFF','H','88888','06-26-2016 16:01:000')
INSERT INTO Users1 Values ('FFFF','F','99999','06-26-2016 23:01:000')

这是我的查询: -

SELECT FName, '-', LName, '-', Number FROM Users1

结果是' - '作为单独的专栏,我不想要,请帮助我

2 个答案:

答案 0 :(得分:0)

SELECT FName +' - '+ LName +' - '+ Number FROM Users1

答案 1 :(得分:0)

尝试SELECT FName +' - '+ LName +' - '+ Number FROM Users1