728x90

https://school.programmers.co.kr/learn/courses/30/lessons/164673

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

 

 

 

풀이)

-- 코드를 입력하세요
# SELECT b.TITLE, b.BOARD_ID, r.REPLY_ID, r.WRITER_ID, r.CONTENTS, date_format(r.created_date, "%Y-%m-%d") as CREATED_DATE
# from used_goods_board as b, used_goods_reply as r 
# where b.board_id = r.board_id and date_format(b.created_date, "%Y-%m")="2022-10" 
# order by r.created_date, b.title;

select b.title, b.board_id, r.reply_id, r.writer_id, r.contents, date_format(r.created_date, "%Y-%m-%d") as created_date
from used_goods_board as b inner join used_goods_reply as r on b.board_id = r.board_id
where date_format(b.created_date, "%Y-%m")="2022-10" 
order by r.created_date, b.title;

join을 사용해야 하는 문제였는데, 두 개의 코드 모두 정답이었다.

 

join을 거의 해본적이 없어서 읽어보면서 했는데, 어렵군.....

 

728x90

+ Recent posts