이 쿼리문좀 알려주세요.
조회수 812회
여기 있는 쿼리문들 좀 설명 좀 해주실 수 있을까요?
웹 게시글 페이징 하려고 알아본건데.
알려주실 수 있을까요?
<게시글 검색 쿼리>
String sql = "SELECT * from ( ";
sql +=" SELECT ";
sql +=" @rownum:=@rownum+1 as rownum,t.* ";
sql +=" FROM ";
sql +=" test t,(select @rownum:=0) rownum ";
sql +=" where 1=1";
if(!"".equals(startDate)){
sql +=" and time_stamp between ? and ? ";
}
if(!"".equals(fileName)){
sql +=" and name like ?";
}
if(!"".equals(word)){
sql +=" and story like ?";
}
sql +=" ) a ";
sql +=" where rownum between ? and ? ";
<게시글 카운트 쿼리>
String sql = "SELECT count(*) from ( ";
sql +=" SELECT ";
sql +=" @rownum:=@rownum+1 as rownum,t.* ";
sql +=" FROM ";
sql +=" test t,(select @rownum:=0) rownum ";
sql +=" where 1=1 ";
if(!"".equals(startDate)){
sql +=" and time_stamp between ? and ? ";
}
if(!"".equals(fileName)){
sql +=" and name like ?";
}
if(!"".equals(word)){
sql +=" and story like ?";
}
sql +=" ) a ";
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력