diff --git a/solution/0500-0599/0585.Investments in 2016/README.md b/solution/0500-0599/0585.Investments in 2016/README.md index ec13524ed04fa..fb0f5002173a1 100644 --- a/solution/0500-0599/0585.Investments in 2016/README.md +++ b/solution/0500-0599/0585.Investments in 2016/README.md @@ -84,11 +84,11 @@ WITH T AS ( SELECT tiv_2016, - COUNT(pid) OVER (PARTITION BY tiv_2015) AS cnt1, - COUNT(pid) OVER (PARTITION BY CONCAT(lat, '-', lon)) AS cnt2 + COUNT(1) OVER (PARTITION BY tiv_2015) AS cnt1, + COUNT(1) OVER (PARTITION BY lat, lon) AS cnt2 FROM Insurance ) -SELECT ROUND(IFNULL(SUM(tiv_2016), 0), 2) AS tiv_2016 +SELECT ROUND(SUM(tiv_2016), 2) AS tiv_2016 FROM T WHERE cnt1 > 1 AND cnt2 = 1; ``` diff --git a/solution/0500-0599/0585.Investments in 2016/README_EN.md b/solution/0500-0599/0585.Investments in 2016/README_EN.md index 904c272d183c1..8df8213cc0241 100644 --- a/solution/0500-0599/0585.Investments in 2016/README_EN.md +++ b/solution/0500-0599/0585.Investments in 2016/README_EN.md @@ -77,11 +77,11 @@ WITH T AS ( SELECT tiv_2016, - COUNT(pid) OVER (PARTITION BY tiv_2015) AS cnt1, - COUNT(pid) OVER (PARTITION BY CONCAT(lat, '-', lon)) AS cnt2 + COUNT(1) OVER (PARTITION BY tiv_2015) AS cnt1, + COUNT(1) OVER (PARTITION BY lat, lon) AS cnt2 FROM Insurance ) -SELECT ROUND(IFNULL(SUM(tiv_2016), 0), 2) AS tiv_2016 +SELECT ROUND(SUM(tiv_2016), 2) AS tiv_2016 FROM T WHERE cnt1 > 1 AND cnt2 = 1; ``` diff --git a/solution/0500-0599/0585.Investments in 2016/Solution.sql b/solution/0500-0599/0585.Investments in 2016/Solution.sql index 30b95dc8c0837..b7d9180a1244c 100644 --- a/solution/0500-0599/0585.Investments in 2016/Solution.sql +++ b/solution/0500-0599/0585.Investments in 2016/Solution.sql @@ -3,10 +3,10 @@ WITH T AS ( SELECT tiv_2016, - COUNT(pid) OVER (PARTITION BY tiv_2015) AS cnt1, - COUNT(pid) OVER (PARTITION BY CONCAT(lat, '-', lon)) AS cnt2 + COUNT(1) OVER (PARTITION BY tiv_2015) AS cnt1, + COUNT(1) OVER (PARTITION BY lat, lon) AS cnt2 FROM Insurance ) -SELECT ROUND(IFNULL(SUM(tiv_2016), 0), 2) AS tiv_2016 +SELECT ROUND(SUM(tiv_2016), 2) AS tiv_2016 FROM T WHERE cnt1 > 1 AND cnt2 = 1;