SQL server easy solution
Key points - \n1. Remove duplicates from the table using CTE\n2. Group by sell_date, count each sell date\n3. Use string_agg function and order within group by 
**Key points - **\n1. Remove duplicates from the table using CTE\n2. Group by sell_date, count each sell date\n3. Use string_agg function and order within group by product.\n\n```\nwith cteactivity AS \n    (SELECT DISTINCT *\n    FROM activities)\nSELECT sell_date,\n\t\t count(product) AS num_sold,\n\t\t string_agg(product, \',\') within group (order by product) AS products\nFROM cteactivity\nGROUP BY  sell_date\nORDER BY  sell_date
['MS SQL Server']