Click here to Skip to main content
14,838,302 members
Home / Discussions / Database
   

Database

 
AnswerRe: Single row for multiple results Pin
Blue_Boy22-Jul-11 8:20
MemberBlue_Boy22-Jul-11 8:20 
GeneralRe: Single row for multiple results Pin
vanikanc22-Jul-11 8:27
Membervanikanc22-Jul-11 8:27 
GeneralRe: Single row for multiple results Pin
Blue_Boy22-Jul-11 8:28
MemberBlue_Boy22-Jul-11 8:28 
AnswerRe: Single row for multiple results Pin
Tim Carmichael22-Jul-11 8:28
MemberTim Carmichael22-Jul-11 8:28 
GeneralRe: Single row for multiple results Pin
vanikanc22-Jul-11 8:42
Membervanikanc22-Jul-11 8:42 
AnswerRe: Single row for multiple results Pin
Shameel22-Jul-11 9:00
professionalShameel22-Jul-11 9:00 
AnswerRe: Single row for multiple results Pin
PIEBALDconsult23-Jul-11 14:07
professionalPIEBALDconsult23-Jul-11 14:07 
AnswerRe: Single row for multiple results Pin
Niladri_Biswas24-Jul-11 22:37
MemberNiladri_Biswas24-Jul-11 22:37 
Assuming Sql Server 2005 and above, try this

Declare @t table([Name] varchar(20),[Status] varchar(50))
insert into @t values
('John Smith','Pending Approval'),('John Smith','Waiting Email Verfication')
--,('User2','Pending Approved'),('User2','Sent email'),('User2','Other activity')
--Select * from @t

select Result = [Name] + '  ' +  Stuff((Select ',' + CAST([Status] as varchar(100)) from @t t2 where t1.[Name] 
= t2.[Name]  for XML Path('')),1,1,'')
from @t t1
group by t1.[Name] 

/*
Result
------
John Smith  Pending Approval,Waiting Email Verfication
*/

Niladri Biswas

SuggestionRe: Single row for multiple results Pin
_Zorro_25-Jul-11 4:22
professional_Zorro_25-Jul-11 4:22 
GeneralRe: Single row for multiple results Pin
vanikanc25-Jul-11 5:22
Membervanikanc25-Jul-11 5:22 
GeneralRe: Single row for multiple results Pin
_Zorro_25-Jul-11 6:20
professional_Zorro_25-Jul-11 6:20 
GeneralRe: Single row for multiple results Pin
smcnulty200025-Jul-11 13:04
Membersmcnulty200025-Jul-11 13:04 
AnswerRe: Single row for multiple results Pin
S Douglas11-Aug-11 9:33
professionalS Douglas11-Aug-11 9:33 
QuestionData on one server, structure on another [modified] Pin
_Zorro_22-Jul-11 0:42
professional_Zorro_22-Jul-11 0:42 
AnswerRe: Data on one server, structure on another Pin
Corporal Agarn22-Jul-11 3:02
professionalCorporal Agarn22-Jul-11 3:02 
GeneralRe: Data on one server, structure on another Pin
_Zorro_22-Jul-11 4:14
professional_Zorro_22-Jul-11 4:14 
GeneralRe: Data on one server, structure on another Pin
Corporal Agarn22-Jul-11 4:27
professionalCorporal Agarn22-Jul-11 4:27 
GeneralRe: Data on one server, structure on another Pin
_Zorro_22-Jul-11 4:50
professional_Zorro_22-Jul-11 4:50 
GeneralRe: Data on one server, structure on another Pin
Corporal Agarn22-Jul-11 5:03
professionalCorporal Agarn22-Jul-11 5:03 
GeneralRe: Data on one server, structure on another Pin
_Zorro_22-Jul-11 5:17
professional_Zorro_22-Jul-11 5:17 
AnswerRe: Data on one server, structure on another Pin
smcnulty200022-Jul-11 20:58
Membersmcnulty200022-Jul-11 20:58 
GeneralRe: Data on one server, structure on another Pin
_Zorro_25-Jul-11 2:37
professional_Zorro_25-Jul-11 2:37 
GeneralRe: Data on one server, structure on another Pin
smcnulty200025-Jul-11 7:33
Membersmcnulty200025-Jul-11 7:33 
GeneralRe: Data on one server, structure on another Pin
_Zorro_25-Jul-11 22:22
professional_Zorro_25-Jul-11 22:22 
GeneralRe: Data on one server, structure on another Pin
smcnulty200025-Jul-11 8:16
Membersmcnulty200025-Jul-11 8:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.