mysql like 검색방법

· 13년 전 · 6029 · 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,342
13년 전 조회 7,866
13년 전 조회 2,379
13년 전 조회 2,564
13년 전 조회 2,311
13년 전 조회 2,448
13년 전 조회 2,780
13년 전 조회 2,598
13년 전 조회 2,687
13년 전 조회 5,293
13년 전 조회 3,734
13년 전 조회 6,010
13년 전 조회 4,705
13년 전 조회 5,880
13년 전 조회 3,667
13년 전 조회 2,913
13년 전 조회 2,625
13년 전 조회 3,709
13년 전 조회 6,626
13년 전 조회 2,644
13년 전 조회 5,492
13년 전 조회 7,034
13년 전 조회 2,934
13년 전 조회 3,942
13년 전 조회 3,281
13년 전 조회 2,238
13년 전 조회 3,934
13년 전 조회 3,394
13년 전 조회 2,415
13년 전 조회 2,066
13년 전 조회 4,864
13년 전 조회 3,250
13년 전 조회 1,974
13년 전 조회 2,123
13년 전 조회 9,786
13년 전 조회 6,321
13년 전 조회 9,206
13년 전 조회 2,129
13년 전 조회 3,056
13년 전 조회 3,231
13년 전 조회 2,866
13년 전 조회 4,147
13년 전 조회 2,641
13년 전 조회 2,775
13년 전 조회 1,977
13년 전 조회 2,834
13년 전 조회 2,740
13년 전 조회 1.4만
13년 전 조회 2,772
13년 전 조회 6,030
13년 전 조회 3,279
13년 전 조회 2,326
13년 전 조회 2,630
13년 전 조회 5,416
13년 전 조회 2,548
13년 전 조회 6,246
13년 전 조회 2,303
13년 전 조회 2,506
13년 전 조회 2,595
13년 전 조회 1만
13년 전 조회 3,133
13년 전 조회 4,203
13년 전 조회 3,350
13년 전 조회 3,578
13년 전 조회 3,669
13년 전 조회 2,414
13년 전 조회 2,630
13년 전 조회 1.9만
13년 전 조회 4,010
13년 전 조회 5,993
13년 전 조회 3,037
13년 전 조회 3,778
13년 전 조회 3,482
13년 전 조회 1.7만
13년 전 조회 2,406
13년 전 조회 2,601
13년 전 조회 2,370
13년 전 조회 3,326
13년 전 조회 4,855
13년 전 조회 4,739
13년 전 조회 3,832
13년 전 조회 6,998
13년 전 조회 4,484
13년 전 조회 7,355
13년 전 조회 3,301
13년 전 조회 2.2만
13년 전 조회 2,532
13년 전 조회 3,047
13년 전 조회 1.8만
13년 전 조회 4,087
13년 전 조회 2,654
13년 전 조회 5,093
13년 전 조회 2,836
13년 전 조회 2,993
13년 전 조회 2,450
13년 전 조회 4,216
13년 전 조회 3,167
13년 전 조회 2,325
13년 전 조회 2,224
13년 전 조회 8,823