Group products using new STRING_AGG funtion
Upvote if you feel it easy :)\n\nThis solution uses latest function STRING_AGG introduced by sql server\n\nSELECT x.sell_date, SUM(x.num_sold) AS num_sold, STRI
**Upvote if you feel it easy :)**\n\nThis solution uses latest function STRING_AGG introduced by sql server\n```\nSELECT x.sell_date, SUM(x.num_sold) AS num_sold, STRING_AGG(x.product,\',\') as products\nFROM (\n\tSELECT top 100 percent sell_date, COUNT(DISTINCT product) as num_sold, product\n\tFROM Activities\n\tGROUP BY sell_date, product\n\tORDER BY sell_date, product\n) X\nGROUP BY x.sell_date\n```
['MS SQL Server']