
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
[지역별]을 추가하여 문제 풀이를 진행하였는데 그림에 나오는 답과 차이가 있습니다. 그림만으로는 정답을 확인하기가 어려워 정답확인 요청드립니다.
작성한 코드 및 에러 메세지
SELECT sido,
cuisine_type,
sum_quantity,
count_of_restaurant,
case when count_of_restaurant>=5 and sum_quantity>=30 then 0.005
when count_of_restaurant>=5 and sum_quantity<30 then 0.008
when count_of_restaurant<5 and sum_quantity>=30 then 0.01
when count_of_restaurant<5 and sum_quantity<30 then 0.02 end ratio_of_add
from
(
SELECT substr(addr,1,2) sido,
cuisine_type,
sum(quantity) sum_quantity,
count(distinct restaurant_name) count_of_restaurant
from food_orders
group by 1, 2
) a
