mysql like 검색방법

· 13년 전 · 4702 · 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년 전 조회 799
13년 전 조회 6,345
13년 전 조회 793
13년 전 조회 985
13년 전 조회 722
13년 전 조회 884
13년 전 조회 1,227
13년 전 조회 1,079
13년 전 조회 1,185
13년 전 조회 3,757
13년 전 조회 2,228
13년 전 조회 4,468
13년 전 조회 3,171
13년 전 조회 4,353
13년 전 조회 2,167
13년 전 조회 1,366
13년 전 조회 1,032
13년 전 조회 2,158
13년 전 조회 5,095
13년 전 조회 1,366
13년 전 조회 4,211
13년 전 조회 5,732
13년 전 조회 1,367
13년 전 조회 2,628
13년 전 조회 1,743
13년 전 조회 702
13년 전 조회 2,419
13년 전 조회 2,171
13년 전 조회 849
13년 전 조회 798
13년 전 조회 3,295
13년 전 조회 1,705
13년 전 조회 728
13년 전 조회 583
13년 전 조회 8,211
13년 전 조회 4,727
13년 전 조회 7,920
13년 전 조회 865
13년 전 조회 1,505
13년 전 조회 1,925
13년 전 조회 1,326
13년 전 조회 2,830
13년 전 조회 1,036
13년 전 조회 1,244
13년 전 조회 726
13년 전 조회 1,260
13년 전 조회 1,467
13년 전 조회 1.3만
13년 전 조회 1,175
13년 전 조회 4,703
13년 전 조회 1,674
13년 전 조회 723
13년 전 조회 1,016
13년 전 조회 3,830
13년 전 조회 1,008
13년 전 조회 4,665
13년 전 조회 750
13년 전 조회 902
13년 전 조회 1,315
13년 전 조회 8,848
13년 전 조회 1,554
13년 전 조회 2,587
13년 전 조회 1,749
13년 전 조회 2,002
13년 전 조회 2,092
13년 전 조회 1,162
13년 전 조회 1,348
13년 전 조회 1.8만
13년 전 조회 2,409
13년 전 조회 4,442
13년 전 조회 1,771
13년 전 조회 2,186
13년 전 조회 2,247
13년 전 조회 1.6만
13년 전 조회 1,163
13년 전 조회 1,011
13년 전 조회 800
13년 전 조회 1,692
13년 전 조회 3,281
13년 전 조회 3,505
13년 전 조회 2,196
13년 전 조회 5,736
13년 전 조회 2,889
13년 전 조회 6,108
13년 전 조회 1,714
13년 전 조회 2.1만
13년 전 조회 991
13년 전 조회 1,482
13년 전 조회 1.7만
13년 전 조회 2,849
13년 전 조회 1,102
13년 전 조회 3,818
13년 전 조회 1,273
13년 전 조회 1,421
13년 전 조회 865
13년 전 조회 2,606
13년 전 조회 1,592
13년 전 조회 731
13년 전 조회 994
13년 전 조회 7,538
🐛 버그신고