SOLUTION WITH STRING_AGG FUNCTION ( SQL SERVER )
Intuition\r\n Describe your first thoughts on how to solve this problem. \r\n\r\n# Approach\r\n Describe your approach to solving the problem. \r\n\r\n# Complex
# Intuition\r\n<!-- Describe your first thoughts on how to solve this problem. -->\r\n\r\n# Approach\r\n<!-- Describe your approach to solving the problem. -->\r\n\r\n# Complexity\r\n- Time complexity:\r\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\r\n\r\n- Space complexity:\r\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\r\n\r\n# Code\r\n```\r\n/* Write your T-SQL query statement below */\r\n\r\n-- /* SOLUTION 1: \r\nSELECT\r\n\tsell_date,\r\n\tCOUNT(product) num_sold,\r\n\tSTRING_AGG(product,\',\') WITHIN GROUP(ORDER BY product ) products \r\nFROM\r\n    (\r\n\r\n        SELECT\r\n            DISTINCT\r\n            sell_date,\r\n            product\r\n        FROM\r\n            Activities\r\n    )TBL\r\n\t\r\nGROUP BY\r\n\tsell_date\r\n--SOLUTION 1: */\r\n```
['MS SQL Server']