Posted by Gowthami, Oct. 1, 2024, 12:42 p.m.
15. Fast movie watchers vs slow watchers - Postgres
why I am getting answer in reverse (my calculations matched)
Expected results
| watcher_category | count |
|---|---|
| fast_watcher | 112 |
| slow_watcher | 487 |
My results
| watcher_category | count |
|---|---|
| fast_watcher | 487 |
| slow_watcher | 112 |
My filter
SELECT
'fast_watcher' AS watcher_category,
count( avg_return_days) as count
from cte
where avg_return_days<=5
UNION ALL
SELECT
'slow_watcher' AS watcher_category,
count( avg_return_days) as count
from cte
where avg_return_days>5
PLEASE ADVICE!!