Avatar of ubsmail
ubsmail

asked on 

CONCATENATE Values in a group

I have seen many articles on concatenating data when grouping but I lack knowledge of functions and am wonder if someone can help me with a select or shed some light on a function necessary to to concatenate a field when grouping.

I am using SQLSERVER 2000
select

MAX('M-'+parentstock.style) as Number,
case when charindex('(', parentstock.title) > 0 then rtrim(LEFT(parentstock.title, charindex('(',parentstock.title )-1)) else parentstock.title end as MasterStyle,

--CONCATENATE with coma sperators parentstock.title here

from parentstock

group by case when charindex('(', parentstock.title) > 0 then rtrim(LEFT(parentstock.title, charindex('(',parentstock.title )-1)) else parentstock.title end

Open in new window

Microsoft SQL Server

Avatar of undefined
Last Comment
ubsmail

8/22/2022 - Mon