mysql like 검색방법

· 13년 전 · 4794 · 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년 전 조회 872
13년 전 조회 6,403
13년 전 조회 875
13년 전 조회 1,070
13년 전 조회 815
13년 전 조회 966
13년 전 조회 1,305
13년 전 조회 1,160
13년 전 조회 1,254
13년 전 조회 3,836
13년 전 조회 2,304
13년 전 조회 4,566
13년 전 조회 3,248
13년 전 조회 4,425
13년 전 조회 2,246
13년 전 조회 1,438
13년 전 조회 1,117
13년 전 조회 2,237
13년 전 조회 5,164
13년 전 조회 1,446
13년 전 조회 4,285
13년 전 조회 5,809
13년 전 조회 1,462
13년 전 조회 2,715
13년 전 조회 1,826
13년 전 조회 787
13년 전 조회 2,497
13년 전 조회 2,247
13년 전 조회 942
13년 전 조회 888
13년 전 조회 3,378
13년 전 조회 1,789
13년 전 조회 813
13년 전 조회 665
13년 전 조회 8,309
13년 전 조회 4,805
13년 전 조회 7,992
13년 전 조회 957
13년 전 조회 1,595
13년 전 조회 1,998
13년 전 조회 1,401
13년 전 조회 2,897
13년 전 조회 1,119
13년 전 조회 1,316
13년 전 조회 814
13년 전 조회 1,334
13년 전 조회 1,532
13년 전 조회 1.3만
13년 전 조회 1,256
13년 전 조회 4,795
13년 전 조회 1,763
13년 전 조회 801
13년 전 조회 1,107
13년 전 조회 3,916
13년 전 조회 1,084
13년 전 조회 4,737
13년 전 조회 829
13년 전 조회 991
13년 전 조회 1,404
13년 전 조회 8,931
13년 전 조회 1,632
13년 전 조회 2,681
13년 전 조회 1,828
13년 전 조회 2,082
13년 전 조회 2,171
13년 전 조회 1,246
13년 전 조회 1,434
13년 전 조회 1.8만
13년 전 조회 2,489
13년 전 조회 4,520
13년 전 조회 1,843
13년 전 조회 2,262
13년 전 조회 2,323
13년 전 조회 1.6만
13년 전 조회 1,251
13년 전 조회 1,088
13년 전 조회 885
13년 전 조회 1,773
13년 전 조회 3,359
13년 전 조회 3,584
13년 전 조회 2,280
13년 전 조회 5,825
13년 전 조회 2,969
13년 전 조회 6,182
13년 전 조회 1,802
13년 전 조회 2.1만
13년 전 조회 1,076
13년 전 조회 1,569
13년 전 조회 1.7만
13년 전 조회 2,938
13년 전 조회 1,194
13년 전 조회 3,910
13년 전 조회 1,358
13년 전 조회 1,503
13년 전 조회 948
13년 전 조회 2,687
13년 전 조회 1,667
13년 전 조회 826
13년 전 조회 1,067
13년 전 조회 7,635
🐛 버그신고