i need to concatenate the rows(taille). for exemple , for the code_commande 001 and code_article=1 , i need to concatenate in list all taille wich have this two conditions. another exemple , for code_commande=001 and code_article=2, the same job i need to concatenate in a list all taille wich have this two condition. this for all
code_commande code_article taille 001 1 s 001 1 m 001 1 xl 001 1 x52 001 2 m 001 1 5566 001 2 x52 001 1 xl 002 1 s 002 2 m 001 3 xxl 002 3 xs 001 1 ml 001 1 xs32
I need to concatenate taille for each code_commande for each code_article exemple of result:
001 1 s,m,xl etcc
dynamicaly
I should have a table who grouped the ( taille) for each code_commande for each code_article like: 001 1 s,m,xl, 001 2 s,xl,l 002 1 xs,ettcc i have tried this query but ,it concatenate all (taille) for all rows the query
Select [code_commande],[code_article], SUBSTRING( ( SELECT ',' +[taille] AS 'data()' FROM [dbo].[commande] FOR XML PATH('') ), 2 , 9999) As taille_commande from [dbo].[commande] order by [code_article],[code_commande]desc