mysql like 검색방법

· 13년 전 · 5930 · 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,060
13년 전 조회 7,587
13년 전 조회 2,074
13년 전 조회 2,264
13년 전 조회 2,024
13년 전 조회 2,146
13년 전 조회 2,486
13년 전 조회 2,300
13년 전 조회 2,407
13년 전 조회 4,989
13년 전 조회 3,429
13년 전 조회 5,701
13년 전 조회 4,394
13년 전 조회 5,578
13년 전 조회 3,382
13년 전 조회 2,620
13년 전 조회 2,289
13년 전 조회 3,410
13년 전 조회 6,342
13년 전 조회 2,531
13년 전 조회 5,391
13년 전 조회 6,938
13년 전 조회 2,636
13년 전 조회 3,821
13년 전 조회 2,989
13년 전 조회 1,970
13년 전 조회 3,657
13년 전 조회 3,298
13년 전 조회 2,135
13년 전 조회 1,954
13년 전 조회 4,577
13년 전 조회 2,955
13년 전 조회 1,884
13년 전 조회 1,864
13년 전 조회 9,471
13년 전 조회 6,010
13년 전 조회 9,103
13년 전 조회 2,032
13년 전 조회 2,760
13년 전 조회 3,126
13년 전 조회 2,590
13년 전 조회 4,044
13년 전 조회 2,365
13년 전 조회 2,493
13년 전 조회 1,884
13년 전 조회 2,554
13년 전 조회 2,629
13년 전 조회 1.4만
13년 전 조회 2,483
13년 전 조회 5,931
13년 전 조회 2,948
13년 전 조회 2,041
13년 전 조회 2,355
13년 전 조회 5,139
13년 전 조회 2,282
13년 전 조회 5,933
13년 전 조회 2,008
13년 전 조회 2,208
13년 전 조회 2,491
13년 전 조회 1만
13년 전 조회 2,842
13년 전 조회 3,928
13년 전 조회 3,054
13년 전 조회 3,259
13년 전 조회 3,381
13년 전 조회 2,315
13년 전 조회 2,520
13년 전 조회 1.9만
13년 전 조회 3,736
13년 전 조회 5,720
13년 전 조회 2,951
13년 전 조회 3,500
13년 전 조회 3,399
13년 전 조회 1.7만
13년 전 조회 2,312
13년 전 조회 2,291
13년 전 조회 2,050
13년 전 조회 3,005
13년 전 조회 4,551
13년 전 조회 4,640
13년 전 조회 3,513
13년 전 조회 6,912
13년 전 조회 4,185
13년 전 조회 7,277
13년 전 조회 2,996
13년 전 조회 2.2만
13년 전 조회 2,251
13년 전 조회 2,767
13년 전 조회 1.8만
13년 전 조회 3,987
13년 전 조회 2,370
13년 전 조회 5,008
13년 전 조회 2,552
13년 전 조회 2,704
13년 전 조회 2,138
13년 전 조회 3,905
13년 전 조회 2,888
13년 전 조회 2,035
13년 전 조회 2,151
13년 전 조회 8,732