$sql_common에 관해 질문드립니다 정보
$sql_common에 관해 질문드립니다본문
우선 목적은 원하는 게시판에서만 게시물을 추출하는 것입니다.
$sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c
where((a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1')
and ((
a.bo_table = '1'
)))";
where((a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1')
and ((
a.bo_table = '1'
)))";
이렇게 수정을 하였더니 1 이라는 게시판에서 추출이 잘 됩니다.
그래서 여러개의 게시판을 지정하여 추출하려고 아래와 같이 수정하였습니다.
$sql_common = " from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c
where((a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1')
and ((
a.bo_table = '1' and
a.bo_table = '2' and
a.bo_table = '3' and
a.bo_table = '4' and
a.bo_table = '5' and
a.bo_table = '6'
)))";
where((a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = '1')
and ((
a.bo_table = '1' and
a.bo_table = '2' and
a.bo_table = '3' and
a.bo_table = '4' and
a.bo_table = '5' and
a.bo_table = '6'
)))";
이렇게 수정하니 ??ۀ̠???ٮ 이런 에러만 나오게 되던..;
무엇이 틀렸을까요? ;;
댓글 전체
a.bo_table = '1' and
a.bo_table = '2' and
a.bo_table = '3' and
a.bo_table = '4' and
a.bo_table = '5' and
a.bo_table = '6'
를 다음처럼 해보세요.
a.bo_table in ('1','2','3','4','5','6')
a.bo_table = '2' and
a.bo_table = '3' and
a.bo_table = '4' and
a.bo_table = '5' and
a.bo_table = '6'
를 다음처럼 해보세요.
a.bo_table in ('1','2','3','4','5','6')
$sql_common = "from {$g4['board_new_table']} a
left outer join {$g4['board_table']} b on a.bo_table=b.bo_table
left outer join {$g4['group_table']} c on b.gr_id=c.gr_id
where b.bo_use_search=1
and a.bo_table RegExp('1|2|3|4|5|6')
";
left outer join {$g4['board_table']} b on a.bo_table=b.bo_table
left outer join {$g4['group_table']} c on b.gr_id=c.gr_id
where b.bo_use_search=1
and a.bo_table RegExp('1|2|3|4|5|6')
";