mysql like 검색방법

· 13년 전 · 5992 · 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,228
13년 전 조회 7,749
13년 전 조회 2,253
13년 전 조회 2,430
13년 전 조회 2,194
13년 전 조회 2,318
13년 전 조회 2,665
13년 전 조회 2,486
13년 전 조회 2,573
13년 전 조회 5,179
13년 전 조회 3,600
13년 전 조회 5,884
13년 전 조회 4,583
13년 전 조회 5,773
13년 전 조회 3,559
13년 전 조회 2,810
13년 전 조회 2,475
13년 전 조회 3,599
13년 전 조회 6,513
13년 전 조회 2,602
13년 전 조회 5,459
13년 전 조회 7,001
13년 전 조회 2,824
13년 전 조회 3,897
13년 전 조회 3,171
13년 전 조회 2,129
13년 전 조회 3,839
13년 전 조회 3,368
13년 전 조회 2,301
13년 전 조회 2,023
13년 전 조회 4,740
13년 전 조회 3,142
13년 전 조회 1,948
13년 전 조회 2,034
13년 전 조회 9,665
13년 전 조회 6,209
13년 전 조회 9,168
13년 전 조회 2,102
13년 전 조회 2,946
13년 전 조회 3,195
13년 전 조회 2,765
13년 전 조회 4,115
13년 전 조회 2,531
13년 전 조회 2,660
13년 전 조회 1,957
13년 전 조회 2,727
13년 전 조회 2,704
13년 전 조회 1.4만
13년 전 조회 2,646
13년 전 조회 5,993
13년 전 조회 3,162
13년 전 조회 2,200
13년 전 조회 2,509
13년 전 조회 5,310
13년 전 조회 2,446
13년 전 조회 6,112
13년 전 조회 2,184
13년 전 조회 2,392
13년 전 조회 2,564
13년 전 조회 1만
13년 전 조회 3,018
13년 전 조회 4,087
13년 전 조회 3,215
13년 전 조회 3,436
13년 전 조회 3,552
13년 전 조회 2,378
13년 전 조회 2,585
13년 전 조회 1.9만
13년 전 조회 3,903
13년 전 조회 5,870
13년 전 조회 3,009
13년 전 조회 3,667
13년 전 조회 3,456
13년 전 조회 1.7만
13년 전 조회 2,370
13년 전 조회 2,455
13년 전 조회 2,234
13년 전 조회 3,174
13년 전 조회 4,713
13년 전 조회 4,700
13년 전 조회 3,686
13년 전 조회 6,968
13년 전 조회 4,346
13년 전 조회 7,327
13년 전 조회 3,157
13년 전 조회 2.2만
13년 전 조회 2,407
13년 전 조회 2,909
13년 전 조회 1.8만
13년 전 조회 4,044
13년 전 조회 2,545
13년 전 조회 5,057
13년 전 조회 2,725
13년 전 조회 2,868
13년 전 조회 2,316
13년 전 조회 4,074
13년 전 조회 3,042
13년 전 조회 2,194
13년 전 조회 2,200
13년 전 조회 8,784