jeudi 30 juin 2016

How can I select all columns as 1 column?

How Do I get the result as below in single Column with '-' Seperated:-

Details

AAAA-A-11111

Here - Details is Column Name

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')

This is my Query :-

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

Result is '-' as separate Column , which I don't want, Please help me

Aucun commentaire:

Enregistrer un commentaire