mysql like 검색방법

· 13년 전 · 6026 · 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,332
13년 전 조회 7,851
13년 전 조회 2,371
13년 전 조회 2,545
13년 전 조회 2,288
13년 전 조회 2,435
13년 전 조회 2,762
13년 전 조회 2,581
13년 전 조회 2,672
13년 전 조회 5,281
13년 전 조회 3,720
13년 전 조회 5,993
13년 전 조회 4,685
13년 전 조회 5,865
13년 전 조회 3,657
13년 전 조회 2,899
13년 전 조회 2,604
13년 전 조회 3,690
13년 전 조회 6,611
13년 전 조회 2,640
13년 전 조회 5,489
13년 전 조회 7,031
13년 전 조회 2,912
13년 전 조회 3,938
13년 전 조회 3,269
13년 전 조회 2,220
13년 전 조회 3,924
13년 전 조회 3,391
13년 전 조회 2,405
13년 전 조회 2,061
13년 전 조회 4,844
13년 전 조회 3,235
13년 전 조회 1,973
13년 전 조회 2,112
13년 전 조회 9,764
13년 전 조회 6,308
13년 전 조회 9,205
13년 전 조회 2,124
13년 전 조회 3,040
13년 전 조회 3,227
13년 전 조회 2,851
13년 전 조회 4,142
13년 전 조회 2,623
13년 전 조회 2,763
13년 전 조회 1,974
13년 전 조회 2,814
13년 전 조회 2,737
13년 전 조회 1.4만
13년 전 조회 2,751
13년 전 조회 6,027
13년 전 조회 3,262
13년 전 조회 2,311
13년 전 조회 2,617
13년 전 조회 5,401
13년 전 조회 2,536
13년 전 조회 6,222
13년 전 조회 2,290
13년 전 조회 2,487
13년 전 조회 2,590
13년 전 조회 1만
13년 전 조회 3,118
13년 전 조회 4,192
13년 전 조회 3,333
13년 전 조회 3,559
13년 전 조회 3,652
13년 전 조회 2,409
13년 전 조회 2,625
13년 전 조회 1.9만
13년 전 조회 3,989
13년 전 조회 5,981
13년 전 조회 3,036
13년 전 조회 3,762
13년 전 조회 3,480
13년 전 조회 1.7만
13년 전 조회 2,402
13년 전 조회 2,585
13년 전 조회 2,354
13년 전 조회 3,306
13년 전 조회 4,835
13년 전 조회 4,735
13년 전 조회 3,807
13년 전 조회 6,996
13년 전 조회 4,457
13년 전 조회 7,353
13년 전 조회 3,288
13년 전 조회 2.2만
13년 전 조회 2,514
13년 전 조회 3,030
13년 전 조회 1.8만
13년 전 조회 4,082
13년 전 조회 2,638
13년 전 조회 5,086
13년 전 조회 2,824
13년 전 조회 2,969
13년 전 조회 2,430
13년 전 조회 4,196
13년 전 조회 3,155
13년 전 조회 2,313
13년 전 조회 2,221
13년 전 조회 8,819