Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Want to display two column data in a single column

Author  Topic 

divyaram
Posting Yak Master

180 Posts

Posted - 2010-07-16 : 08:04:39
Hi All,

I need one help... i want to select to one UserID column and RoleID from two tables,
and i want to display the result it like this

USERSRole ROLES
105-1,106-1,107-1 Manager
117-2,118-2 Teamlead
1023-3,1056-3,1078-3 engineer

but i am getting like this only

USERSRole ROLES
105-1,106-1,107-1,117-2,118-2,1023-3,1056-3,1078-3 Manager
105-1,106-1,107-1,117-2,118-2,1023-3,1056-3,1078-3 Teamlead
105-1,106-1,107-1,117-2,118-2,1023-3,1056-3,1078-3 engineer

i have done query like this....

DECLARE @Roles_userID VARCHAR(MAX)
SELECT @Roles_userID=

(COALESCE(@Roles_JournalID+',','')+(COALESCE (CAST(FIS_User.user_id as varchar(25))+'-','')+
(COALESCE (FIS_Roles.role,''))))

FROM FIS_User WITH(NOLOCK)
INNER JOIN FIS_Roles WITH(NOLOCK) ON FIS_User.User_ID =FIS_Roles.Created_By
group by FIS_User.user_id,FIS_Roles.role



Regards,
Divya

divyaram
Posting Yak Master

180 Posts

Posted - 2010-07-16 : 09:32:21
CAN ANY ONE HELP ME!!!!!!!!!!!!!!!

Regards,
Divya
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-07-16 : 09:49:05
dude..it's been like an hour and a half



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-07-16 : 09:50:50
post the ddl and sample data in dml format

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -