mysql like 검색방법

· 13년 전 · 6008 · 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,272
13년 전 조회 7,792
13년 전 조회 2,303
13년 전 조회 2,481
13년 전 조회 2,231
13년 전 조회 2,363
13년 전 조회 2,706
13년 전 조회 2,514
13년 전 조회 2,611
13년 전 조회 5,221
13년 전 조회 3,649
13년 전 조회 5,923
13년 전 조회 4,626
13년 전 조회 5,812
13년 전 조회 3,607
13년 전 조회 2,847
13년 전 조회 2,525
13년 전 조회 3,637
13년 전 조회 6,555
13년 전 조회 2,616
13년 전 조회 5,473
13년 전 조회 7,013
13년 전 조회 2,859
13년 전 조회 3,919
13년 전 조회 3,214
13년 전 조회 2,165
13년 전 조회 3,869
13년 전 조회 3,377
13년 전 조회 2,347
13년 전 조회 2,039
13년 전 조회 4,780
13년 전 조회 3,176
13년 전 조회 1,960
13년 전 조회 2,063
13년 전 조회 9,706
13년 전 조회 6,245
13년 전 조회 9,182
13년 전 조회 2,116
13년 전 조회 2,991
13년 전 조회 3,213
13년 전 조회 2,804
13년 전 조회 4,130
13년 전 조회 2,574
13년 전 조회 2,699
13년 전 조회 1,964
13년 전 조회 2,765
13년 전 조회 2,722
13년 전 조회 1.4만
13년 전 조회 2,703
13년 전 조회 6,009
13년 전 조회 3,205
13년 전 조회 2,245
13년 전 조회 2,562
13년 전 조회 5,351
13년 전 조회 2,490
13년 전 조회 6,160
13년 전 조회 2,225
13년 전 조회 2,438
13년 전 조회 2,573
13년 전 조회 1만
13년 전 조회 3,055
13년 전 조회 4,132
13년 전 조회 3,267
13년 전 조회 3,492
13년 전 조회 3,601
13년 전 조회 2,395
13년 전 조회 2,607
13년 전 조회 1.9만
13년 전 조회 3,950
13년 전 조회 5,918
13년 전 조회 3,020
13년 전 조회 3,710
13년 전 조회 3,467
13년 전 조회 1.7만
13년 전 조회 2,385
13년 전 조회 2,505
13년 전 조회 2,285
13년 전 조회 3,232
13년 전 조회 4,769
13년 전 조회 4,721
13년 전 조회 3,739
13년 전 조회 6,979
13년 전 조회 4,392
13년 전 조회 7,339
13년 전 조회 3,211
13년 전 조회 2.2만
13년 전 조회 2,447
13년 전 조회 2,966
13년 전 조회 1.8만
13년 전 조회 4,057
13년 전 조회 2,587
13년 전 조회 5,070
13년 전 조회 2,757
13년 전 조회 2,911
13년 전 조회 2,361
13년 전 조회 4,126
13년 전 조회 3,091
13년 전 조회 2,235
13년 전 조회 2,209
13년 전 조회 8,799