Skip to navigation
Concat string in mssql group query
27.04.22
SELECT ltrim(rtrim(av0_code)) AS av0_code ,ISNULL(SUBSTRING( ( SELECT DISTINCT ','+bb.av0_ball_size AS [text()] FROM sl.dbo.av0_style bb WHERE bb.av0_code = b.av0_code AND bb.av0_ball_size != '' --ORDER BY bb.av0_ball_size FOR XML PATH (''), TYPE ).value('text()[1]','nvarchar(max)'), 2, 1000),'') av0_ball_size FROM sl.dbo.av0_style AS b LEFT JOIN sl.dbo.av0_style_extra AS e ON b.av0_style = e.av0_style LEFT JOIN sl.dbo.av21_kode_for_style AS c ON b.av0_code = c.av21_code LEFT JOIN SL.dbo.clr_stone_color AS s ON b.av0_color_1 = s.tzr_stone_color LEFT JOIN sl.dbo.zz_categories AS ca ON b.F21_av0_section = ca.F21_av0_section AND e.category = ca.category WHERE b.av0_not_to_sale = '0' AND b.av0_metal NOT IN('PK') AND b.av0_not_active = '0' AND b.av0_finding = '0' AND b.F34_av0_a = '0' AND b.av0_group NOT IN('CA','M','MT','PT','RU','SRV','PIC','STK') AND b.av0_Group2 NOT IN('CA','M','MT','PT','RU','SRV','PIC','STK') AND NOT EXISTS ( SELECT TOP 1 av0_code FROM [SL_customer].[dbo].[av0_code] as bb WHERE bb.av0_code = b.av0_code ) GROUP BY av0_code
Reply
Anonymous
Information Epoch 1732505283
Programmer time is expensive, conserve it in preference to machine time.
Home
Notebook
Contact us