mysql like 검색방법

· 13년 전 · 5966 · 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,161
13년 전 조회 7,698
13년 전 조회 2,185
13년 전 조회 2,373
13년 전 조회 2,135
13년 전 조회 2,253
13년 전 조회 2,597
13년 전 조회 2,436
13년 전 조회 2,513
13년 전 조회 5,106
13년 전 조회 3,537
13년 전 조회 5,811
13년 전 조회 4,508
13년 전 조회 5,689
13년 전 조회 3,489
13년 전 조회 2,733
13년 전 조회 2,409
13년 전 조회 3,531
13년 전 조회 6,445
13년 전 조회 2,576
13년 전 조회 5,422
13년 전 조회 6,970
13년 전 조회 2,750
13년 전 조회 3,872
13년 전 조회 3,107
13년 전 조회 2,073
13년 전 조회 3,763
13년 전 조회 3,338
13년 전 조회 2,246
13년 전 조회 1,996
13년 전 조회 4,695
13년 전 조회 3,073
13년 전 조회 1,926
13년 전 조회 1,974
13년 전 조회 9,581
13년 전 조회 6,139
13년 전 조회 9,139
13년 전 조회 2,080
13년 전 조회 2,898
13년 전 조회 3,166
13년 전 조회 2,698
13년 전 조회 4,086
13년 전 조회 2,471
13년 전 조회 2,608
13년 전 조회 1,923
13년 전 조회 2,665
13년 전 조회 2,679
13년 전 조회 1.4만
13년 전 조회 2,594
13년 전 조회 5,967
13년 전 조회 3,084
13년 전 조회 2,148
13년 전 조회 2,454
13년 전 조회 5,246
13년 전 조회 2,384
13년 전 조회 6,043
13년 전 조회 2,126
13년 전 조회 2,316
13년 전 조회 2,537
13년 전 조회 1만
13년 전 조회 2,961
13년 전 조회 4,037
13년 전 조회 3,162
13년 전 조회 3,380
13년 전 조회 3,482
13년 전 조회 2,347
13년 전 조회 2,557
13년 전 조회 1.9만
13년 전 조회 3,836
13년 전 조회 5,816
13년 전 조회 2,975
13년 전 조회 3,601
13년 전 조회 3,434
13년 전 조회 1.7만
13년 전 조회 2,339
13년 전 조회 2,406
13년 전 조회 2,174
13년 전 조회 3,116
13년 전 조회 4,651
13년 전 조회 4,680
13년 전 조회 3,622
13년 전 조회 6,942
13년 전 조회 4,284
13년 전 조회 7,301
13년 전 조회 3,098
13년 전 조회 2.2만
13년 전 조회 2,349
13년 전 조회 2,849
13년 전 조회 1.8만
13년 전 조회 4,019
13년 전 조회 2,478
13년 전 조회 5,029
13년 전 조회 2,664
13년 전 조회 2,813
13년 전 조회 2,245
13년 전 조회 4,004
13년 전 조회 2,996
13년 전 조회 2,145
13년 전 조회 2,172
13년 전 조회 8,766