SQL/문제풀이
Group Sold Products By The Date _ Medium. LeetCode
데이터분석가 이채은
2025. 1. 10. 21:13
SELECT sell_date,
COUNT(DISTINCT(product)) AS num_sold,
GROUP_CONCAT(DISTINCT product ORDER BY product ASC separator ',') AS products
FROM Activities
GROUP BY sell_date
ORDER BY sell_date ASC;
GROUP_CONCAT에 대해서 처음 알았다. 원래 CONCAT이나 CONCAT_WS인가?라고 생각했었는데 적용을 할 수가 없어서 답을 확인해야 했다.