Posted by Bowen, Dec. 10, 2022, 7:19 p.m.
Why this solution is not accepted? (quetsion # 140)
This query can yield the same results with the 'official' solution, but it's not accepted by the system.
Can someone tell me why?
with daily_rev as
(select
date(created_at) as date,
restaurant_id,
sum(total_amt) as daily_revenue
from food_order
where restaurant_id = 100011
group by 1,2
)
select
a.date,
coalesce(b.restaurant_id,100011) as restaurant_id,
coalesce(b.daily_revenue,0) as daily_revenue
from dates a left join daily_rev b
on a.date = b.date
where a.date >= '2021-08-01'
and a.date < '2021-09-01'