테스트 사이트 - 개발 중인 베타 버전입니다

자료 조회가 이상합니다. 채택완료

평상심NZ 1년 전 조회 2,085

안녕하세요.

 

저의 테스트 환경은 아래와 같습니다.

디버깅해서 확인한 SQL 문의 결과가 1로 나옵니다.

</p>

<p>SELECT COUNT(DISTINCT `wr_parent`) AS `cnt` FROM g5_write_ebook WHERE ((INSTR(wr_subject, '이상')) ) and (wr_num between -81 and (-81 + 10000))</p>

<p>

 

그런데 실제 테이블에는 더 많은 레코드가 있거든요.

 

테이블이 아래와 같구요.

http://sir.kr/data/editor/2401/1914117670_1705798090.3599.png" width="100%" />


걸리는 것은 사용환경이 맥북인데, 여기저기 뒤져보니 맥북의 한글처리가 문제가 있는것처럼 보이는데, 그걸까요?

테이블 인코드는 utf8_general_ci 입니다.

 

phpmyadmin에서 위 SQL을 던져도 결과는 같습니다. 

instr 대신이 like를 사용해도 같은 결과가 나오더라구요.

 

귀신에 홀린것도 아니고...

 

경험이 있으신 분의 조언을 부탁드립니다.

댓글을 작성하려면 로그인이 필요합니다.

답변 3개

채택된 답변
+20 포인트
세크티
1년 전

cnt가 1로 나온다는 건가요?row가1개 나온다는건가요?

위 sql문에서는 row가 1개 나오는건 정상이고, cnt는 1이나오면 이상한게 맞습니다.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

평상심NZ
1년 전
cnt도 row도 1이 나옵니다.

모두 3이 나와야 하는것 아닌가요?

댓글을 작성하려면 로그인이 필요합니다.

평상심NZ
1년 전

'날개 이상', '날개(이상).epub' 값이 실제로는

이상하게 저장되어 있습니다.

희안하게도 화면에 보이는 것은 모아쓰기가 되어 있네요. ㅠㅠ

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

평상심NZ
1년 전

</p>

<p><a href="<a href="http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/select.html" target="_blank" rel="noopener noreferrer">http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/select.html</a>" target="mysql_doc">SELECT</a> <a href="<a href="http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html%23function_count" target="_blank" rel="noopener noreferrer">http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html%23function_count</a>" target="mysql_doc">COUNT</a>(DISTINCT `wr_parent`) AS `cnt` FROM g5_write_ebook WHERE ((INSTR(wr_subject, '이상')) ) <a href="<a href="http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html%23operator_and" target="_blank" rel="noopener noreferrer">http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html%23operator_and</a>" target="mysql_doc">and</a> (wr_num between -81 <a href="<a href="http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html%23operator_and" target="_blank" rel="noopener noreferrer">http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html%23operator_and</a>" target="mysql_doc">and</a> (-81 + 10000));



<a href="<a href="http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/select.html" target="_blank" rel="noopener noreferrer">http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/select.html</a>" target="mysql_doc">SELECT</a> * FROM g5_write_ebook WHERE ((INSTR(wr_subject, '이상')) ) <a href="<a href="http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html%23operator_and" target="_blank" rel="noopener noreferrer">http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html%23operator_and</a>" target="mysql_doc">and</a> (wr_num between -81 <a href="<a href="http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html%23operator_and" target="_blank" rel="noopener noreferrer">http://localhost/phpmyadmin/url.php?url=https://dev.mysql.com/doc/refman/8.0/en/logical-operators.html%23operator_and</a>" target="mysql_doc">and</a> (-81 + 10000));</p>

<p>

모두 1개 나옵니다.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인