mysql like 검색방법

· 13년 전 · 6022 · 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,320
13년 전 조회 7,842
13년 전 조회 2,356
13년 전 조회 2,528
13년 전 조회 2,274
13년 전 조회 2,417
13년 전 조회 2,749
13년 전 조회 2,564
13년 전 조회 2,657
13년 전 조회 5,269
13년 전 조회 3,699
13년 전 조회 5,980
13년 전 조회 4,673
13년 전 조회 5,855
13년 전 조회 3,648
13년 전 조회 2,884
13년 전 조회 2,587
13년 전 조회 3,680
13년 전 조회 6,602
13년 전 조회 2,635
13년 전 조회 5,488
13년 전 조회 7,024
13년 전 조회 2,902
13년 전 조회 3,932
13년 전 조회 3,260
13년 전 조회 2,208
13년 전 조회 3,909
13년 전 조회 3,389
13년 전 조회 2,395
13년 전 조회 2,054
13년 전 조회 4,833
13년 전 조회 3,223
13년 전 조회 1,972
13년 전 조회 2,099
13년 전 조회 9,753
13년 전 조회 6,294
13년 전 조회 9,202
13년 전 조회 2,122
13년 전 조회 3,027
13년 전 조회 3,225
13년 전 조회 2,841
13년 전 조회 4,142
13년 전 조회 2,610
13년 전 조회 2,745
13년 전 조회 1,973
13년 전 조회 2,803
13년 전 조회 2,733
13년 전 조회 1.4만
13년 전 조회 2,740
13년 전 조회 6,023
13년 전 조회 3,249
13년 전 조회 2,292
13년 전 조회 2,606
13년 전 조회 5,391
13년 전 조회 2,529
13년 전 조회 6,211
13년 전 조회 2,278
13년 전 조회 2,478
13년 전 조회 2,586
13년 전 조회 1만
13년 전 조회 3,095
13년 전 조회 4,180
13년 전 조회 3,317
13년 전 조회 3,545
13년 전 조회 3,639
13년 전 조회 2,406
13년 전 조회 2,621
13년 전 조회 1.9만
13년 전 조회 3,983
13년 전 조회 5,971
13년 전 조회 3,032
13년 전 조회 3,748
13년 전 조회 3,475
13년 전 조회 1.7만
13년 전 조회 2,398
13년 전 조회 2,567
13년 전 조회 2,337
13년 전 조회 3,296
13년 전 조회 4,821
13년 전 조회 4,732
13년 전 조회 3,790
13년 전 조회 6,992
13년 전 조회 4,442
13년 전 조회 7,350
13년 전 조회 3,267
13년 전 조회 2.2만
13년 전 조회 2,497
13년 전 조회 3,017
13년 전 조회 1.8만
13년 전 조회 4,076
13년 전 조회 2,629
13년 전 조회 5,081
13년 전 조회 2,810
13년 전 조회 2,955
13년 전 조회 2,422
13년 전 조회 4,181
13년 전 조회 3,151
13년 전 조회 2,295
13년 전 조회 2,213
13년 전 조회 8,816