
1번 쿼리와 2번 쿼리의 결과 값이 다른데, 그 이유를 모르겠습니다.
c 의 순서 만 바꿨습니다
1번.
SELECT c.checkin_id, c.course_id, c.user_id, c.likes,
(
SELECT avg(likes) from checkins
where course_id = c.course_id
) as course_avg
from checkins c
2번.
SELECT checkin_id, course_id, user_id, likes,
(
SELECT avg(likes) from checkins c
where c.course_id = course_id
) as course_avg
from checkins
