
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
inner join에서 어떤 컬럼으로 컬럼으로 하느냐에 따라 결과값이 달라지는데 왜 그런지 알 수 있을까요?
강의 자료에서는 user_id로 했는데 저는 course_id로 했는데 그 이유는 orders 테이블에도 course_id가 있어서 연결이 될 것 같아 그렇게 쿼리를 짰습니다.
2번째 Inner Join시 user_id로 Join

2번째 Inner Join시 course_id로 Join

select c.title, c2.week, count(*) from courses c
inner join checkins c2 on c.course_id = c2.course_id
inner join orders o on c2.user_id = o.user_id
Where o.created_at >= '2020-08-01'
GROUP by c.title, c2.week
ORDER by c.title, c2.week
select c.title, c2.week, count(*) from courses c
inner join checkins c2 on c.course_id = c2.course_id
inner join orders o on c2.course_id = o.course_id
Where o.created_at >= '2020-08-01'
GROUP by c.title, c2.week
ORDER by c.title, c2.week
