mysql like 검색방법

· 13년 전 · 4673 · 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년 전 조회 765
13년 전 조회 6,306
13년 전 조회 757
13년 전 조회 946
13년 전 조회 698
13년 전 조회 843
13년 전 조회 1,193
13년 전 조회 1,046
13년 전 조회 1,154
13년 전 조회 3,718
13년 전 조회 2,186
13년 전 조회 4,438
13년 전 조회 3,141
13년 전 조회 4,316
13년 전 조회 2,138
13년 전 조회 1,337
13년 전 조회 999
13년 전 조회 2,128
13년 전 조회 5,070
13년 전 조회 1,330
13년 전 조회 4,171
13년 전 조회 5,696
13년 전 조회 1,341
13년 전 조회 2,598
13년 전 조회 1,709
13년 전 조회 671
13년 전 조회 2,389
13년 전 조회 2,137
13년 전 조회 820
13년 전 조회 774
13년 전 조회 3,266
13년 전 조회 1,670
13년 전 조회 698
13년 전 조회 563
13년 전 조회 8,187
13년 전 조회 4,691
13년 전 조회 7,885
13년 전 조회 834
13년 전 조회 1,473
13년 전 조회 1,888
13년 전 조회 1,287
13년 전 조회 2,796
13년 전 조회 1,003
13년 전 조회 1,211
13년 전 조회 698
13년 전 조회 1,236
13년 전 조회 1,425
13년 전 조회 1.3만
13년 전 조회 1,143
13년 전 조회 4,674
13년 전 조회 1,652
13년 전 조회 701
13년 전 조회 982
13년 전 조회 3,794
13년 전 조회 966
13년 전 조회 4,630
13년 전 조회 717
13년 전 조회 867
13년 전 조회 1,283
13년 전 조회 8,810
13년 전 조회 1,522
13년 전 조회 2,564
13년 전 조회 1,708
13년 전 조회 1,961
13년 전 조회 2,058
13년 전 조회 1,128
13년 전 조회 1,320
13년 전 조회 1.8만
13년 전 조회 2,373
13년 전 조회 4,406
13년 전 조회 1,739
13년 전 조회 2,162
13년 전 조회 2,210
13년 전 조회 1.6만
13년 전 조회 1,129
13년 전 조회 982
13년 전 조회 767
13년 전 조회 1,660
13년 전 조회 3,246
13년 전 조회 3,481
13년 전 조회 2,165
13년 전 조회 5,704
13년 전 조회 2,853
13년 전 조회 6,071
13년 전 조회 1,673
13년 전 조회 2.1만
13년 전 조회 953
13년 전 조회 1,446
13년 전 조회 1.7만
13년 전 조회 2,826
13년 전 조회 1,075
13년 전 조회 3,788
13년 전 조회 1,241
13년 전 조회 1,392
13년 전 조회 830
13년 전 조회 2,573
13년 전 조회 1,555
13년 전 조회 705
13년 전 조회 956
13년 전 조회 7,514
🐛 버그신고