create table member (

id bigint auto_increment primary key,

nickname varchar(60) not null

);


create_table follow(

follower bigint not null, -- 팔로워

followee bigint not null, -- 팔로우 대상


foreign key(`follower`) references `member`(id),

foreign key(`followee`) references `member` (id),

primary key(`follower`, `followee`)

);


이렇게 테이블 있다고 할 때


어떤 사람의 팔로워들을 조회해서 보는 API를 짜는데,

거기에 있는 사람들이 나를 팔로우하는지 여부를 같이 넣어서 조회하려고함.


일단 서브쿼리로는 동작하더라고





뭐 이런식으로


이걸 셀프조인 형태로 짤수 있을까


서브쿼리 쓰지말라고 배워서...