Skip to content

Commit c58852e

Browse files
authored
Update 1132. Reported Posts II.sql
1 parent db833fb commit c58852e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

medium/1132. Reported Posts II.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,16 @@ percentage AS(
1212
)
1313

1414
SELECT ROUND(AVG(per),2) AS avg_daily_percent FROM percentage;
15+
16+
--------------------------- OR ---------------------------
17+
18+
WITH cte AS (
19+
SELECT a.action_date,
20+
ROUND(COUNT(CASE WHEN a.extra = 'spam' AND r.post_id IS NOT NULL THEN 1 ELSE NULL END)*100::NUMERIC/COUNT(DISTINCT a.post_id),2) AS removed_spammed_post_percentage
21+
FROM actions_1132 a
22+
LEFT JOIN removals_1132 r ON a.post_id = r.post_id
23+
GROUP BY a.action_date
24+
)
25+
SELECT ROUND(AVG(removed_spammed_post_percentage),2)
26+
FROM cte
27+
WHERE removed_spammed_post_percentage <> 0;

0 commit comments

Comments
 (0)