개요
1
2
3
select *
from follow f1, follow f2
on f1.followed_id = f2.following_id
1
ERROR 1064 (42000) at line 27: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'on f1.followed_id = f2.following_id' at line 3
sql 문장을 실행했을때 syntax 오류가 발생했다. 분명 join 제대로 했고 특별히 문제될 것 없어보이는데 오류가 났다.
발생 원인
문법에러가 발생하는 이유는 join 을 쉼표로(암시적 조인) 하면 on 문법을 사용할 수 없기때문이다.
1
2
3
select *
from follow f1 join follow f2
on f1.followed_id = f2.following_id
따라서 join 을 명시해주면 해결된다.