MSSQL + XML PATH
\n1. Distinct Rows\n\t\tselect distinct * from activities\n\n\n2. XML Path\n\t\tselect \',\' + tb1.product from (select distinct * from activities) tb1 for XML 
```\n1. Distinct Rows\n\t\tselect distinct * from activities\n```\n```\n2. XML Path\n\t\tselect \',\' + tb1.product from (select distinct * from activities) tb1 for XML path(\'\')\n```\n```\n3. Add Stuff\n\t\tselect products = stuff((select \',\' + a.product from (select distinct * from activities) a for XML path(\'\')),1,1,\'\')\n```\n```\n4. Subquery\n\t\tselect sell_date, count(distinct product) \'num_sold\', \n\t\tproducts = stuff((select \',\' + a.product from (select distinct * from activities) a \n\t\twhere a.sell_date = aa.sell_date for XMl path(\'\')),1,1,\'\')\n\t\tfrom Activities aa group by aa.sell_date\n```
[]