I am using SQL SERVER 2008 R2 and I have situation like simple select gives multiple rows from two tables with inner join. I want to get simply these mutilple rows into one single row with TAB delimited.
Here is my simple SQL
Select 'xxx',a.userid, a.status,ISNULL (Convert(varcha r,a.time,108),' ' ) AS TIME,a.uid
from TABLE AS a WITH (NOLOCK)
Inner join TABLE AS b WITH (NOLOCK) on
a.status = b.statuscode
I am getting the data by using above SQL as
xxx john CMD 10:50:06 plk
xxx smith CMDT 10:50:29 smk
xxx chris CMDT 10:50:29 ll
xxx smith CMD 10:50:38 plk
where as I want to get this in all in ONE line like below
xxx john CMD 10:50:06 plk smith CMDT 10:50:29 smk chris CMDT 10:50:29 lll smith CMD 10:50:38 plk
Here is my simple SQL
Select 'xxx',a.userid, a.status,ISNULL (Convert(varcha r,a.time,108),' ' ) AS TIME,a.uid
from TABLE AS a WITH (NOLOCK)
Inner join TABLE AS b WITH (NOLOCK) on
a.status = b.statuscode
I am getting the data by using above SQL as
xxx john CMD 10:50:06 plk
xxx smith CMDT 10:50:29 smk
xxx chris CMDT 10:50:29 ll
xxx smith CMD 10:50:38 plk
where as I want to get this in all in ONE line like below
xxx john CMD 10:50:06 plk smith CMDT 10:50:29 smk chris CMDT 10:50:29 lll smith CMD 10:50:38 plk
Comment