
아래 코드에서 오류가 나는데, 어느 부분이 잘못된 건지 질문드립니다.
with table1 as (
select course_id, count(distinct(user_id)) as cnt_checkins from checkins c
group by course_id
), table2 as (
select course_id, count(*) as cnt_total from orders o
group by course_id
)
select 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 c2 on a.course_id = c2.course_id
