SQL Join -3) LEFT JOIN : A에 해당하는 부분
SELECT * FROM topic LEFT JOIN author ON topic.author_id = author.aid LEFT JOIN profile ON author.profile_id = profile.pid
21-04-01
테이블 합치기 참고에서
SELECT tid, topic.title, author_id, name, profile.title AS job_title FROM topic LEFT JOIN author ON topic.author_id = author.aid LEFT JOIN profile ON author.profile_id = profile.pid;
결과 표에서 tid 는 aid 가 없는데 3이라고 나오네요. job_title 은 NULLL 오타나써여
감사합니다 잘배우고 있습니다.
완료! ... 그런데 topic.author_id 를 ON 조건에 넣고 left join 하게되면 왜 tid가 오름차순으로 정렬되지 않는데 (1-3-2-4로 정렬됨...) 왜 그런 건가요!? ORDER BY tid ASC 또는 topic.tid를 ON 조건으로 넣으면 해결되는 걸보니, ON 조건에 따라 정렬 기준이 바뀌는 건가요?