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
 Sql Scripting Problem

Author  Topic 

chava_sree
Yak Posting Veteran

56 Posts

Posted - 2008-03-21 : 13:37:31
I’ve a subquery which returns more than one row (user_group), and i need to convert those rows into a comma delimited list. i tried with various possibilities but unable to find the solution. can you pls.help.

here is my query below.

SELECT
user_ID,
user_Firstname,
user_Lastname,
user_Email,
Username = (Case When user_Username = ‘ ‘ or user_username is Null then ‘None’ else User_Username end),
user_creationdate,
Active = (Case When user_Active = 1 then ‘Yes’ else ‘No’ end),
User_Group = (Select group_name from usergroup a, usergroup_combo b where a.group_id = b.ug_groupID and b.ug_userid = user_id),
TheatreCode = (Case When User_TheaterCode = ‘ ‘ or User_TheaterCode is Null then ‘N/A’ else User_TheaterCode end),
JobTitle = (Case When user_JobTitle = ‘ ‘ or User_Jobtitle is Null then ‘N/A’ else User_Jobtitle end)
FROM [user]

thanks

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-03-21 : 15:52:03
you can use this
http://weblogs.sqlteam.com/mladenp/archive/2007/06/01/60220.aspx

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page
   

- Advertisement -