From 2d90186885b7e434f080c360bfe5b55821230996 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Tue, 10 Oct 2023 22:57:26 +0800 Subject: [PATCH] feat: update sql solution to lc problem: No.1484 --- .../1484.Group Sold Products By The Date/README.md | 9 +++------ .../1484.Group Sold Products By The Date/README_EN.md | 9 +++------ .../1484.Group Sold Products By The Date/Solution.sql | 7 +++---- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/solution/1400-1499/1484.Group Sold Products By The Date/README.md b/solution/1400-1499/1484.Group Sold Products By The Date/README.md index 99d3ef95746cd..884e6f4514eed 100644 --- a/solution/1400-1499/1484.Group Sold Products By The Date/README.md +++ b/solution/1400-1499/1484.Group Sold Products By The Date/README.md @@ -70,13 +70,10 @@ Activities 表: SELECT sell_date, COUNT(DISTINCT product) AS num_sold, - GROUP_CONCAT(DISTINCT product - ORDER BY product ASC - SEPARATOR ',') AS products -FROM - Activities + GROUP_CONCAT(DISTINCT product) AS products +FROM Activities GROUP BY sell_date -ORDER BY sell_date ASC; +ORDER BY sell_date; ``` diff --git a/solution/1400-1499/1484.Group Sold Products By The Date/README_EN.md b/solution/1400-1499/1484.Group Sold Products By The Date/README_EN.md index 8c61111e1c35f..8b0789278c74e 100644 --- a/solution/1400-1499/1484.Group Sold Products By The Date/README_EN.md +++ b/solution/1400-1499/1484.Group Sold Products By The Date/README_EN.md @@ -68,13 +68,10 @@ For 2020-06-02, the Sold item is (Mask), we just return it. SELECT sell_date, COUNT(DISTINCT product) AS num_sold, - GROUP_CONCAT(DISTINCT product - ORDER BY product ASC - SEPARATOR ',') AS products -FROM - Activities + GROUP_CONCAT(DISTINCT product) AS products +FROM Activities GROUP BY sell_date -ORDER BY sell_date ASC; +ORDER BY sell_date; ``` diff --git a/solution/1400-1499/1484.Group Sold Products By The Date/Solution.sql b/solution/1400-1499/1484.Group Sold Products By The Date/Solution.sql index 4c9a8325b4630..5dfb92954aa54 100644 --- a/solution/1400-1499/1484.Group Sold Products By The Date/Solution.sql +++ b/solution/1400-1499/1484.Group Sold Products By The Date/Solution.sql @@ -1,10 +1,9 @@ -SELECT +SELECT sell_date, COUNT(DISTINCT product) AS num_sold, GROUP_CONCAT(DISTINCT product - ORDER BY product ASC - SEPARATOR ',') AS products + ORDER BY product) AS products FROM Activities GROUP BY sell_date -ORDER BY sell_date ASC; +ORDER BY sell_date;