
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
SELECT
c.course_id ,
c.likes,
(
select c2.title from courses c2 where c2.course_id =c.course_id
)as title,
(
SELECT round(avg(c3.likes),1) from checkins c3 WHERE c3.course_id =c.course_id
)as avg_likes
FROM checkins c
order by title
select절에 들어가는 서브쿼리 퀴즈 질문입니다.
위와 같이 코딩했을 때 올바르게 나오지만
SELECT
c.user_id
c.course_id ,
c.likes,
(
select c2.title from courses c2 where c2.course_id =c.course_id
)as title,
(
SELECT round(avg(c3.likes),1) from checkins c3 WHERE c3.course_id =c.course_id
)as avg_likes
FROM checkins c
order by title
이것처럼 c.user_id 라든가 c.checkin_id를 추가했을 때
SQL Error [1064] [42000]: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.course_id ,
c.likes,
(
select c2.title from courses c2 where c2.course_id =c' at line 3
다음과같은
에러가 뜹니다.
