sql server 2005 - How should I modify this SQL statement? -
my sql server view
select geo.hyperlinks.catid, geo.tags.tag, geo.hyperlinks.hyperlinksid geo.hyperlinks left outer join geo.tags inner join geo.tagslist on geo.tags.tagid = geo.tagslist.tagid on geo.hyperlinks.hyperlinksid = geo.tagslist.hyperlinksid hyperlinksid = 1
returns these...
hyperlinksid catid tags 1 2 sport 1 2 tennis 1 2 golf
how should modify above have results like
hyperlinksid catid tagsinonerowseperatedwithspacecharacter 1 2 sport tennis golf
update: brad suggested came here...
declare @taglist varchar(100) select @taglist = coalesce(@taglist + ', ', '') + cast(tagid nvarchar(100)) tagslist hyperlinksid = 1 select @taglist
now result looks
hyperlinksid catid tagsinonerowseperatedwithspacecharacter 1 2 id_of_sport id_of_tennis id_of_golf
and of course have combine contents from the@taglist
variable , original select
statement...
which means i'll have wait holy bounty :(
if sql, try post:
if want try hand @ clr code, there examples of creating custom aggregate function concatenation, again, ms sql.
this post pretty exhaustive lots of ways accomplish goal.
Comments
Post a Comment