체크박스 이용 검색 만들때 sql 문 문의드립니다. 정보
체크박스 이용 검색 만들때 sql 문 문의드립니다.본문
체크박스가 몇개 있고 그 값들이 zcode1 ~ zcode10 까지 있다고 가정하에
필드는 zcode1 ~ zcode10 이렇게 있습니다. 각 각의 필드안에 값들이 들어있고
중복체크해서 sql 문을 만들려고 하니 잘 안되네요 ㅜㅜ
and 를 써도 안되고 or 도 안되고...
and 를 사용하니 zcode1 에는 있는데 zcode2 에 없으니 출력이 안되네요.. ㅜㅜ
------------------------------------
$sql_search = " where a.mb_id = b.mb_id and b.mp_last_date >= '$g4[time_ymd]' ";
if ($stx) {
$sql_search .= " and zcode1 = '서울' ";
$sql_search .= " and zcode2 = '인천' ";
$sql_search .= " and zcode3 = '경기' ";
}
-----------------------------------------------------------------------
위와 같은 방식인데요 ㅜㅜ 예를들어 서울 체크 인천 체크 하면 서울 하고 인천이 포함된 것들이
쫙 나왔으면 하거든요 sql 문 좀 부탁드립니다... 흑흑..
필드는 zcode1 ~ zcode10 이렇게 있습니다. 각 각의 필드안에 값들이 들어있고
중복체크해서 sql 문을 만들려고 하니 잘 안되네요 ㅜㅜ
and 를 써도 안되고 or 도 안되고...
and 를 사용하니 zcode1 에는 있는데 zcode2 에 없으니 출력이 안되네요.. ㅜㅜ
------------------------------------
$sql_search = " where a.mb_id = b.mb_id and b.mp_last_date >= '$g4[time_ymd]' ";
if ($stx) {
$sql_search .= " and zcode1 = '서울' ";
$sql_search .= " and zcode2 = '인천' ";
$sql_search .= " and zcode3 = '경기' ";
}
-----------------------------------------------------------------------
위와 같은 방식인데요 ㅜㅜ 예를들어 서울 체크 인천 체크 하면 서울 하고 인천이 포함된 것들이
쫙 나왔으면 하거든요 sql 문 좀 부탁드립니다... 흑흑..
( select a.* , ( select sum(co_count) as co_count from g4_qa_choose where mb_id=a.mb_id and bo_table = 'g4_qa' ) as q_co_count from `g4_write_g4_qa` a where wr_parent = '283030' and wr_8 != '' and wr_is_comment = 1 and CONVERT(wr_7, UNSIGNED) >= 5 group by wr_content having max(wr_7) order by CONVERT(wr_7, UNSIGNED) desc limit 3 )
1055 : Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'sir.a.wr_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
error file : /15sir/bbs/board.php