mysql like 검색방법

· 13년 전 · 5797 · 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,900
13년 전 조회 7,438
13년 전 조회 1,924
13년 전 조회 2,094
13년 전 조회 1,870
13년 전 조회 2,000
13년 전 조회 2,311
13년 전 조회 2,157
13년 전 조회 2,260
13년 전 조회 4,832
13년 전 조회 3,281
13년 전 조회 5,573
13년 전 조회 4,231
13년 전 조회 5,430
13년 전 조회 3,247
13년 전 조회 2,466
13년 전 조회 2,147
13년 전 조회 3,254
13년 전 조회 6,178
13년 전 조회 2,397
13년 전 조회 5,275
13년 전 조회 6,807
13년 전 조회 2,471
13년 전 조회 3,699
13년 전 조회 2,800
13년 전 조회 1,792
13년 전 조회 3,511
13년 전 조회 3,161
13년 전 조회 1,983
13년 전 조회 1,839
13년 전 조회 4,397
13년 전 조회 2,796
13년 전 조회 1,743
13년 전 조회 1,700
13년 전 조회 9,320
13년 전 조회 5,836
13년 전 조회 8,966
13년 전 조회 1,903
13년 전 조회 2,586
13년 전 조회 2,984
13년 전 조회 2,441
13년 전 조회 3,929
13년 전 조회 2,187
13년 전 조회 2,334
13년 전 조회 1,740
13년 전 조회 2,380
13년 전 조회 2,504
13년 전 조회 1.4만
13년 전 조회 2,310
13년 전 조회 5,798
13년 전 조회 2,809
13년 전 조회 1,861
13년 전 조회 2,188
13년 전 조회 4,978
13년 전 조회 2,135
13년 전 조회 5,767
13년 전 조회 1,856
13년 전 조회 2,040
13년 전 조회 2,355
13년 전 조회 9,916
13년 전 조회 2,663
13년 전 조회 3,768
13년 전 조회 2,899
13년 전 조회 3,079
13년 전 조회 3,230
13년 전 조회 2,178
13년 전 조회 2,401
13년 전 조회 1.9만
13년 전 조회 3,565
13년 전 조회 5,574
13년 전 조회 2,836
13년 전 조회 3,328
13년 전 조회 3,253
13년 전 조회 1.7만
13년 전 조회 2,176
13년 전 조회 2,115
13년 전 조회 1,884
13년 전 조회 2,843
13년 전 조회 4,388
13년 전 조회 4,533
13년 전 조회 3,375
13년 전 조회 6,780
13년 전 조회 4,026
13년 전 조회 7,157
13년 전 조회 2,854
13년 전 조회 2.2만
13년 전 조회 2,097
13년 전 조회 2,616
13년 전 조회 1.8만
13년 전 조회 3,859
13년 전 조회 2,204
13년 전 조회 4,872
13년 전 조회 2,375
13년 전 조회 2,536
13년 전 조회 1,971
13년 전 조회 3,727
13년 전 조회 2,723
13년 전 조회 1,880
13년 전 조회 2,014
13년 전 조회 8,593