mysql like 검색방법

· 13년 전 · 6023 · 9
너무 궁금해서 아무리 찾아도 저와 비슷한 질문을 한 사람이 없더군요. like 검색시에 대소문자를 구분해서 검색하는 방법이 뭐가 있을까 생각하다가... 예를들어, name 컬럼에 abc 라는 값이 들어있고, select * from table where name like '%Bc%' 이렇게 해도 검색이 되더라 이겁니다. 물론 필드형을 바꾸어 주거나 하는 방법이 있지만.... select * from table where binary(name) like '%Bc%' 이렇게 하면 대소문자를 구분하여 검색이 안되고, select * from table where binary(name) like '%bc%' 이렇게 해야만 검색

첨부파일

mysql_like_검색.txt (50 bytes) 48회 2012-12-02 13:10
|

댓글 9개

http://dev.mysql.com/doc/refman/5.5/en/case-sensitivity.html

To make this search case sensitive, make sure that one of the operands has a case sensitive or binary collation. For example, if you are comparing a column and a string that both have the latin1 character set, you can use the COLLATE operator to cause either operand to have the latin1_general_cs or latin1_bin collation:

col_name COLLATE latin1_general_cs LIKE 'a%'
col_name LIKE 'a%' COLLATE latin1_general_cs
col_name COLLATE latin1_bin LIKE 'a%'
col_name LIKE 'a%' COLLATE latin1_bin
감사합니다
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
13년 전 조회 2,321
13년 전 조회 7,843
13년 전 조회 2,356
13년 전 조회 2,532
13년 전 조회 2,274
13년 전 조회 2,417
13년 전 조회 2,751
13년 전 조회 2,567
13년 전 조회 2,663
13년 전 조회 5,270
13년 전 조회 3,705
13년 전 조회 5,983
13년 전 조회 4,674
13년 전 조회 5,856
13년 전 조회 3,648
13년 전 조회 2,885
13년 전 조회 2,591
13년 전 조회 3,680
13년 전 조회 6,603
13년 전 조회 2,635
13년 전 조회 5,489
13년 전 조회 7,026
13년 전 조회 2,904
13년 전 조회 3,933
13년 전 조회 3,261
13년 전 조회 2,208
13년 전 조회 3,913
13년 전 조회 3,390
13년 전 조회 2,395
13년 전 조회 2,055
13년 전 조회 4,834
13년 전 조회 3,224
13년 전 조회 1,972
13년 전 조회 2,100
13년 전 조회 9,757
13년 전 조회 6,296
13년 전 조회 9,202
13년 전 조회 2,122
13년 전 조회 3,027
13년 전 조회 3,225
13년 전 조회 2,841
13년 전 조회 4,142
13년 전 조회 2,611
13년 전 조회 2,751
13년 전 조회 1,974
13년 전 조회 2,805
13년 전 조회 2,733
13년 전 조회 1.4만
13년 전 조회 2,742
13년 전 조회 6,024
13년 전 조회 3,252
13년 전 조회 2,292
13년 전 조회 2,607
13년 전 조회 5,393
13년 전 조회 2,529
13년 전 조회 6,212
13년 전 조회 2,280
13년 전 조회 2,478
13년 전 조회 2,586
13년 전 조회 1만
13년 전 조회 3,098
13년 전 조회 4,180
13년 전 조회 3,319
13년 전 조회 3,545
13년 전 조회 3,639
13년 전 조회 2,407
13년 전 조회 2,622
13년 전 조회 1.9만
13년 전 조회 3,983
13년 전 조회 5,971
13년 전 조회 3,033
13년 전 조회 3,751
13년 전 조회 3,476
13년 전 조회 1.7만
13년 전 조회 2,399
13년 전 조회 2,567
13년 전 조회 2,337
13년 전 조회 3,296
13년 전 조회 4,826
13년 전 조회 4,732
13년 전 조회 3,798
13년 전 조회 6,992
13년 전 조회 4,443
13년 전 조회 7,351
13년 전 조회 3,267
13년 전 조회 2.2만
13년 전 조회 2,502
13년 전 조회 3,018
13년 전 조회 1.8만
13년 전 조회 4,077
13년 전 조회 2,629
13년 전 조회 5,082
13년 전 조회 2,815
13년 전 조회 2,957
13년 전 조회 2,424
13년 전 조회 4,188
13년 전 조회 3,151
13년 전 조회 2,295
13년 전 조회 2,213
13년 전 조회 8,818