Query works in MySQL but not in SQL Server

Viewed 40

I'm trying to fire a query on leetcode which works in MySQL but gives runtime error in SQL Server.

Can anybody tell what exactly happening here? I'm little confused.

This is my activity table

enter image description here

and this is the problem statement

Write an SQL query to find the daily active user count for a period of 30 days ending 2019-07-27 inclusively. A user was active on someday if they made at least one activity on that day. Return the result table in any order.

This is the query I tried

select 
    activity_date as day, 
    count(distinct user_id) as active_users 
from
    activity 
where 
    activity_date between '2019-06-28' and '2019-07-27'
group by 
    activity_date
0 Answers
Related