DB

MySQL - 2

Hoon1994 2024. 3. 6. 21:12
SELECT topic.id AS topic_id, title, description, created, name, profile FROM topic LEFT JOIN author ON topic.author_id = author.id;

 

LEFT JOIN : 왼쪽 테이블의 모든 정보를 포함하면서 오른쪽 테이블과 매칭되는 정보가 있을 경우 결합

 

ON : 결합 조건 지정 (topic.author_id = author.id)

 

AS : 별칭 지정