CREATE TABLE #temp(Names varchar(10),Description varchar(20))
insert into #temp values('suresh','dfsdf')
insert into #temp values('vijayans','12212')
insert into #temp values('suresh','232132')
insert into #temp values('suresh','=====')
insert into #temp values('vijayans','10000')SELECT
Names ,
REPLACE(RTRIM((SELECT [description] + ' ' FROM #temp WHERE (Names = Results.Names) FOR XML PATH (''))),' ',', ') AS NameValues FROM #temp Results GROUP BY NAMES
DROP TABLE #temp
insert into #temp values('suresh','dfsdf')
insert into #temp values('vijayans','12212')
insert into #temp values('suresh','232132')
insert into #temp values('suresh','=====')
insert into #temp values('vijayans','10000')SELECT
Names ,
REPLACE(RTRIM((SELECT [description] + ' ' FROM #temp WHERE (Names = Results.Names) FOR XML PATH (''))),' ',', ') AS NameValues FROM #temp Results GROUP BY NAMES
DROP TABLE #temp
07:29 |
Category:
SQL SERVER
|
0
comments
Comments (0)