mysql like 검색방법

· 13년 전 · 5975 · 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,176
13년 전 조회 7,706
13년 전 조회 2,202
13년 전 조회 2,385
13년 전 조회 2,148
13년 전 조회 2,266
13년 전 조회 2,611
13년 전 조회 2,445
13년 전 조회 2,521
13년 전 조회 5,121
13년 전 조회 3,560
13년 전 조회 5,820
13년 전 조회 4,523
13년 전 조회 5,708
13년 전 조회 3,499
13년 전 조회 2,746
13년 전 조회 2,426
13년 전 조회 3,544
13년 전 조회 6,460
13년 전 조회 2,584
13년 전 조회 5,434
13년 전 조회 6,978
13년 전 조회 2,767
13년 전 조회 3,879
13년 전 조회 3,120
13년 전 조회 2,089
13년 전 조회 3,782
13년 전 조회 3,347
13년 전 조회 2,259
13년 전 조회 2,007
13년 전 조회 4,710
13년 전 조회 3,092
13년 전 조회 1,933
13년 전 조회 1,988
13년 전 조회 9,599
13년 전 조회 6,158
13년 전 조회 9,147
13년 전 조회 2,085
13년 전 조회 2,908
13년 전 조회 3,171
13년 전 조회 2,716
13년 전 조회 4,098
13년 전 조회 2,486
13년 전 조회 2,623
13년 전 조회 1,936
13년 전 조회 2,681
13년 전 조회 2,685
13년 전 조회 1.4만
13년 전 조회 2,607
13년 전 조회 5,976
13년 전 조회 3,106
13년 전 조회 2,164
13년 전 조회 2,465
13년 전 조회 5,259
13년 전 조회 2,394
13년 전 조회 6,058
13년 전 조회 2,139
13년 전 조회 2,340
13년 전 조회 2,551
13년 전 조회 1만
13년 전 조회 2,979
13년 전 조회 4,045
13년 전 조회 3,178
13년 전 조회 3,394
13년 전 조회 3,503
13년 전 조회 2,362
13년 전 조회 2,569
13년 전 조회 1.9만
13년 전 조회 3,853
13년 전 조회 5,832
13년 전 조회 2,991
13년 전 조회 3,620
13년 전 조회 3,441
13년 전 조회 1.7만
13년 전 조회 2,347
13년 전 조회 2,420
13년 전 조회 2,187
13년 전 조회 3,126
13년 전 조회 4,663
13년 전 조회 4,686
13년 전 조회 3,639
13년 전 조회 6,949
13년 전 조회 4,296
13년 전 조회 7,308
13년 전 조회 3,110
13년 전 조회 2.2만
13년 전 조회 2,363
13년 전 조회 2,864
13년 전 조회 1.8만
13년 전 조회 4,023
13년 전 조회 2,488
13년 전 조회 5,037
13년 전 조회 2,679
13년 전 조회 2,824
13년 전 조회 2,260
13년 전 조회 4,016
13년 전 조회 3,008
13년 전 조회 2,154
13년 전 조회 2,181
13년 전 조회 8,769