theScore | Take Home Assignment | Recent View Game Page

Hello,

I did not get the role for the position and I was reviewing my code, seems as though the last question was wrong.

Here is the schema:

image

Question:

Write a query to find the number of users who viewed their most recent game page in the following timeframes: Last 30 days, 31 to 59 days ago or 60+ days ago.

Here is my code that I wrote, can anyone help assist with telling me why it was wrong and what would be the correct solution?

Any feedback would be appericiated!

count  ( Case when datediff( today(), toronto_date ) <= 30 then  account_id  else 0 end ) asLast 30 Days” ,

count(case when datediff(today(), toronto_date) >= 31 and datediff(today(), toronto_date) <= 59 then account_id  else 0 end )  as31 to 49 Days ago” , 

count(case when datediff(today(), toronto_date) >= 60 then account_id  else 0 end )  as60 Days ago” 

From pages  p
Inner join games g 
On p.game_id = g.id 
Where game_time = max(game_time) 
Group by article_id 
Comments (1)