sql_query() 구한 값 합치는 방법이 있을까요?

$out_hos_re_26 = sql_query("select * from g4_write_membership where (wr_1 between '00000000' and '$to_date') AND wr_26 = $to_date");
$out_hos_re_30 = sql_query("select * from g4_write_membership where (wr_1 between '00000000' and '$to_date') AND wr_30 = $to_date");
$out_hos_re_33 = sql_query("select * from g4_write_membership where (wr_1 between '00000000' and '$to_date') AND wr_33 = $to_date");


3개의 쿼리문으로 구한 데이터를 하나로 합치려고 아래 처럼 했는데 안되네요..

$result = array($out_hos_re_26 + $out_hos_re_30 + $out_hos_re_33);

for ($i=0; $row=sql_fetch_array($result); $i++) {

echo $row[wr_subject];
}


array 말고 join , array_merge 사용해도 안되네요...

방법이 있을까요???
|

댓글 3개

해결했습니다 ㅡㅡ;;; 왜~ 왜~ 질답란에 질문을 하고 구글신께 문의드리면 답을 주시는지... 모르겠습니다.

union 또는 union all 로 처리하면 되는군요...



$out_hos_re_26 = sql_query("select * from g4_write_membership where (wr_1 between '00000000' and '$to_date') AND wr_26 = $to_date
union all
select * from g4_write_membership where (wr_1 between '00000000' and '$to_date') AND wr_30 = $to_date
union all
select * from g4_write_membership where (wr_1 between '00000000' and '$to_date') AND wr_33 = $to_date");

이리하면 되는군요 ,....^^;;;
$out_hos_re_tot = sql_query("select * from g4_write_membership where (wr_1 between '00000000' and '$to_date') AND (wr_26 = $to_date OR wr_30 = $to_date OR wr_33 = $to_date)");
감사합니다 루트님...^^ 전 각각 행들에서 값을 뽑아내야 해서요.. 이렇게 한방에 하는 방법도 있지만 저리하면 제가 원하는 결과 값이 나오지가 않아서요..^^
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
12년 전 조회 1,617
12년 전 조회 1,043
12년 전 조회 806
12년 전 조회 799
12년 전 조회 983
12년 전 조회 2,150
12년 전 조회 1,615
12년 전 조회 1,032
12년 전 조회 1,427
12년 전 조회 1,580
12년 전 조회 907
12년 전 조회 943
12년 전 조회 829
12년 전 조회 800
12년 전 조회 2,826
12년 전 조회 1,532
12년 전 조회 782
12년 전 조회 485
12년 전 조회 1,595
12년 전 조회 656