sql 쿼리문 3가지 문의합니다.

sql 쿼리문 3가지 문의합니다.

QA

sql 쿼리문 3가지 문의합니다.

답변 1

본문

1. 내가 작성한 게시물

2. 내가 작성한 코멘트

3. 내 게시글에 달린 댓글 

 

위 3가지의 쿼리문 좀 알려주세요. 어떤 테이블에서 어떤 조건으로 뽑아야 하는지?

 

 

(예) 아래처림 생긴 구문 

$board = sql_fetch("select * from {$g4['board_table']} where bo_table = '{$bo_table}'"); 

 

 

 

이 질문에 댓글 쓰기 :

답변 1

1. select * from {$g4['board_table']} where bo_table = '{$bo_table}' and mb_id = '{$ss_mb_id}' and wr_is_comment =0

 

2. select * from {$g4['board_table']} where bo_table = '{$bo_table}' and mb_id = '{$ss_mb_id}' and wr_is_comment =1

 

 

3. select wr_id from {$g4['board_table']} where bo_table = '{$bo_table}' and mb_id = '{$ss_mb_id}' and wr_is_comment =0 자신의 글을 가져와서 wr_id 

   select * from {$g4['board_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and wr_is_comment =1

 

이렇게 하심 되지 싶은데 마지막껀 여러글이 있을수 잇으니 for 문 돌리신후 그아래 한번더 돌리시면 될것 같은데요

 

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 2,572
© SIRSOFT
현재 페이지 제일 처음으로