mysql like 검색방법

· 13년 전 · 5642 · 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년 전 조회 1,819
13년 전 조회 7,354
13년 전 조회 1,837
13년 전 조회 2,004
13년 전 조회 1,765
13년 전 조회 1,912
13년 전 조회 2,224
13년 전 조회 2,083
13년 전 조회 2,159
13년 전 조회 4,744
13년 전 조회 3,206
13년 전 조회 5,487
13년 전 조회 4,154
13년 전 조회 5,345
13년 전 조회 3,166
13년 전 조회 2,390
13년 전 조회 2,067
13년 전 조회 3,173
13년 전 조회 6,089
13년 전 조회 2,278
13년 전 조회 5,134
13년 전 조회 6,662
13년 전 조회 2,380
13년 전 조회 3,559
13년 전 조회 2,727
13년 전 조회 1,705
13년 전 조회 3,428
13년 전 조회 3,020
13년 전 조회 1,905
13년 전 조회 1,681
13년 전 조회 4,301
13년 전 조회 2,717
13년 전 조회 1,599
13년 전 조회 1,620
13년 전 조회 9,230
13년 전 조회 5,764
13년 전 조회 8,800
13년 전 조회 1,764
13년 전 조회 2,509
13년 전 조회 2,862
13년 전 조회 2,362
13년 전 조회 3,785
13년 전 조회 2,096
13년 전 조회 2,251
13년 전 조회 1,601
13년 전 조회 2,303
13년 전 조회 2,361
13년 전 조회 1.4만
13년 전 조회 2,224
13년 전 조회 5,643
13년 전 조회 2,720
13년 전 조회 1,789
13년 전 조회 2,092
13년 전 조회 4,924
13년 전 조회 2,051
13년 전 조회 5,675
13년 전 조회 1,777
13년 전 조회 1,952
13년 전 조회 2,183
13년 전 조회 9,767
13년 전 조회 2,594
13년 전 조회 3,693
13년 전 조회 2,818
13년 전 조회 2,996
13년 전 조회 3,160
13년 전 조회 2,045
13년 전 조회 2,236
13년 전 조회 1.9만
13년 전 조회 3,481
13년 전 조회 5,502
13년 전 조회 2,689
13년 전 조회 3,265
13년 전 조회 3,104
13년 전 조회 1.7만
13년 전 조회 2,026
13년 전 조회 2,033
13년 전 조회 1,826
13년 전 조회 2,759
13년 전 조회 4,306
13년 전 조회 4,387
13년 전 조회 3,297
13년 전 조회 6,635
13년 전 조회 3,959
13년 전 조회 7,015
13년 전 조회 2,786
13년 전 조회 2.2만
13년 전 조회 2,041
13년 전 조회 2,555
13년 전 조회 1.8만
13년 전 조회 3,721
13년 전 조회 2,110
13년 전 조회 4,731
13년 전 조회 2,302
13년 전 조회 2,460
13년 전 조회 1,895
13년 전 조회 3,661
13년 전 조회 2,643
13년 전 조회 1,787
13년 전 조회 1,859
13년 전 조회 8,438