9. ARPU 2.1 Error message in ARPU 2


#1

Hi everyone,

When I run the code below I get the error message 'Select Daily players in a with clause'. However if i put a 'with' before daily players the code doesn't even run. When I run it like the code is below I do get a query result; however the only results are DT and Players and thus no results from the first part (the revenue).


https://www.codecademy.com/en/courses/sql-analyzing-business-metrics/lessons/common-metrics/exercises/arpu-iii?action=resume

Select Daily Players in a with clause.

with daily_revenue as (
  select
    date(created_at) as dt,
    round(sum(price), 2) as rev
  from purchases
  where refunded_at is null
  group by 1
), 
daily_players as (
  select
    date(created_at) as dt,
    user_id as players
  from gameplays
  group by 1
)
select * from daily_players order by dt;

Any help would be great.


#2

I found the error.
In the second part beneath daily_players the "user_id as players", should have been "count(distinct user_id) as players"


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.