mysql like 검색방법

· 13년 전 · 6019 · 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,314
13년 전 조회 7,837
13년 전 조회 2,348
13년 전 조회 2,519
13년 전 조회 2,267
13년 전 조회 2,411
13년 전 조회 2,742
13년 전 조회 2,559
13년 전 조회 2,652
13년 전 조회 5,263
13년 전 조회 3,690
13년 전 조회 5,973
13년 전 조회 4,666
13년 전 조회 5,851
13년 전 조회 3,640
13년 전 조회 2,881
13년 전 조회 2,575
13년 전 조회 3,672
13년 전 조회 6,592
13년 전 조회 2,633
13년 전 조회 5,486
13년 전 조회 7,022
13년 전 조회 2,897
13년 전 조회 3,929
13년 전 조회 3,252
13년 전 조회 2,200
13년 전 조회 3,902
13년 전 조회 3,389
13년 전 조회 2,388
13년 전 조회 2,050
13년 전 조회 4,828
13년 전 조회 3,217
13년 전 조회 1,967
13년 전 조회 2,093
13년 전 조회 9,745
13년 전 조회 6,287
13년 전 조회 9,197
13년 전 조회 2,121
13년 전 조회 3,020
13년 전 조회 3,223
13년 전 조회 2,834
13년 전 조회 4,141
13년 전 조회 2,607
13년 전 조회 2,738
13년 전 조회 1,971
13년 전 조회 2,800
13년 전 조회 2,733
13년 전 조회 1.4만
13년 전 조회 2,734
13년 전 조회 6,020
13년 전 조회 3,243
13년 전 조회 2,288
13년 전 조회 2,598
13년 전 조회 5,386
13년 전 조회 2,523
13년 전 조회 6,201
13년 전 조회 2,266
13년 전 조회 2,470
13년 전 조회 2,585
13년 전 조회 1만
13년 전 조회 3,093
13년 전 조회 4,173
13년 전 조회 3,309
13년 전 조회 3,541
13년 전 조회 3,630
13년 전 조회 2,402
13년 전 조회 2,618
13년 전 조회 1.9만
13년 전 조회 3,978
13년 전 조회 5,962
13년 전 조회 3,031
13년 전 조회 3,746
13년 전 조회 3,475
13년 전 조회 1.7만
13년 전 조회 2,396
13년 전 조회 2,562
13년 전 조회 2,326
13년 전 조회 3,289
13년 전 조회 4,816
13년 전 조회 4,729
13년 전 조회 3,785
13년 전 조회 6,990
13년 전 조회 4,433
13년 전 조회 7,349
13년 전 조회 3,259
13년 전 조회 2.2만
13년 전 조회 2,492
13년 전 조회 3,007
13년 전 조회 1.8만
13년 전 조회 4,075
13년 전 조회 2,618
13년 전 조회 5,080
13년 전 조회 2,806
13년 전 조회 2,952
13년 전 조회 2,416
13년 전 조회 4,178
13년 전 조회 3,141
13년 전 조회 2,289
13년 전 조회 2,213
13년 전 조회 8,815