
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
강의에서 with 절을 배웠는데, with절과 with절 아래에 나오는 쿼리를 함께 드래그하여 실행하지 않으면 오류가 나는 것 같습니다.
with 절을 쓴다면, 매번 with 절과 다음 쿼리를 드래그 한 이후에 실행해야 하나요?


with table1 as (
SELECT c.course_id,count(DISTINCT (c.user_id)) as cnt_checkins FROM checkins c
group by c.course_id
), table2 as (
select o.course_id, count(*) as cnt_total FROM orders o
group by o.course_id
)
select c.title,
a.cnt_checkins,
b.cnt_total,
round((a.cnt_checkins/b.cnt_total),3) as ratio
FROM table1 a
inner join table2 b on a.course_id = b.course_id
inner join courses c on c.course_id = a.course_id
SQL Error [1146] [42S02]: Table 'sparta.table1' doesn't exist
