
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
with절 배우는 중인데, table1이 없다구 나옵니다 무슨 문제일까요?
작성한 코드 및 에러 메세지
with table1 as (
select course_id , count(DISTINCT user_id) as cnt_checkins from checkins
group by course_id
),
table2 as (
select course_id ,count(*) as cnt_total from orders o
group by course_id
)
select co.title ,
a.cnt_checkins,
b.cnt_total,
(a.cnt_checkins/b.cnt_total) as ratio
from table1 a
inner join table2 b on a.course_id = b.course_id
inner join courses co
on co.course_id = a.course_id
