728x90
<select id="getWritingList" resultType="com.MyBlog.Dto.Board">
select * from board
<where>
<if test="query !=null and query != ''">
${field} like '%${query}%'
</if>
and
<if test="categoryName != ''">
categoryName = #{categoryName}
</if>
<if test="categoryName ==''">
categoryName like '%${categoryName}%'
</if>
and
<if test="uri != '/index/category' ">
nickName like '%%'
</if>
<if test="uri =='/index/category'">
nickName = #{nickName}
</if>
and
<if test="uri =='/index/category' or uri =='/index' ">
channelName like '%%'
</if>
<if test="uri !='/index/category' and uri !='/index' ">
channelName = #{channelName}
</if>
and pub = #{pub}
order by ${order} ${desc}
limit #{offset}, #{size}
</where>
</select>
지금은 해결 했으나
에러의 발단은
1. 쿼리 문 작성 중에 channelName 컬럼 기본 값은 null -> '' 로 변경 . 즉 공백값
2. 그 후 쿼리문에서는 channelName의 null값은 고려하지 않았다.
3. 그러나 기존에 생성된 null값에 의해 2 페이지로 넘어가도 null값 입력된 수의 갯수만큼
게시글 개수가 일치하지 않았음.
==> DB table에 channelName컬럼 null data삭제
로 해결
728x90
'MySQL' 카테고리의 다른 글
[MySQL] 맥북 MySQL 설치(homebrew) (0) | 2022.04.13 |
---|---|
[mysql][문제해결] You are using safe update mode (0) | 2022.02.22 |
그룹별 상위 5개 가져오기 (0) | 2022.02.18 |
MySQL table과 view 차이 (0) | 2022.02.10 |
식별관계(Identifying Relationship)과 비식별관계(Non Identifying Relationship)출처: https://linuxism.ustd.ip.or.kr/512 [linuxism] (0) | 2022.01.28 |
댓글