
inner join 관련해서 궁금한 점이 생겨서 질문드립니다.
웹개발, 앱개발 종합반의 week별 체크인 중 8월 1일 이후에 구매한 고객들의 수를 구하기 위해서
inner join을 사용해 테이블을 연결할 때, courses, checkins, orders 테이블이 모두 course_id 를 공통으로 가지고 있었기에
아래와 같이 연결시키면 값이 다르게 나오는 이유는 무엇인가요 ?
1) courses, checkins, orders 테이블 모두 course_id 로 inner join 했을 때
SELECT c1.title, c2.week, count(*) from courses c1
inner join checkins c2 on c1.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 c1.title, c2.week
order by c1.title, c2.week

2) courses, checkins 테이블을 course_id 로,
checkins, orders 테이블을 user_id 로 inner join 했을 때
SELECT c1.title, c2.week, count(*) from courses c1
inner join checkins c2 on c1.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 c1.title, c2.week
order by c1.title, c2.week

