
orders 테이블을 inner join할때 user.id가 아니라 course_id 를 키값으로 하면 결과가 이상하게 나오는데 왜그러는걸까요? ㅠㅠ
공통된 키값 중에 어떤 키값을 골라야지 문제를 해결할 수 있을지 감이 잘 안잡힙니다.
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 c1.course_id = o.course_id
where o.created_at >= '2020-08-01'
group by c1.title, c2.week
order by c1.title, c2.week
