mysql like 검색방법

· 13년 전 · 5479 · 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,644
13년 전 조회 7,193
13년 전 조회 1,715
13년 전 조회 1,825
13년 전 조회 1,595
13년 전 조회 1,734
13년 전 조회 2,046
13년 전 조회 1,932
13년 전 조회 2,005
13년 전 조회 4,583
13년 전 조회 3,059
13년 전 조회 5,334
13년 전 조회 4,011
13년 전 조회 5,182
13년 전 조회 3,011
13년 전 조회 2,230
13년 전 조회 1,897
13년 전 조회 3,011
13년 전 조회 5,937
13년 전 조회 2,161
13년 전 조회 5,029
13년 전 조회 6,566
13년 전 조회 2,219
13년 전 조회 3,422
13년 전 조회 2,563
13년 전 조회 1,553
13년 전 조회 3,277
13년 전 조회 2,864
13년 전 조회 1,728
13년 전 조회 1,552
13년 전 조회 4,165
13년 전 조회 2,579
13년 전 조회 1,451
13년 전 조회 1,456
13년 전 조회 9,085
13년 전 조회 5,602
13년 전 조회 8,646
13년 전 조회 1,606
13년 전 조회 2,353
13년 전 조회 2,740
13년 전 조회 2,203
13년 전 조회 3,646
13년 전 조회 1,924
13년 전 조회 2,082
13년 전 조회 1,452
13년 전 조회 2,128
13년 전 조회 2,176
13년 전 조회 1.3만
13년 전 조회 2,055
13년 전 조회 5,480
13년 전 조회 2,548
13년 전 조회 1,609
13년 전 조회 1,940
13년 전 조회 4,805
13년 전 조회 1,895
13년 전 조회 5,531
13년 전 조회 1,599
13년 전 조회 1,786
13년 전 조회 2,049
13년 전 조회 9,547
13년 전 조회 2,433
13년 전 조회 3,500
13년 전 조회 2,675
13년 전 조회 2,834
13년 전 조회 3,008
13년 전 조회 1,885
13년 전 조회 2,071
13년 전 조회 1.8만
13년 전 조회 3,319
13년 전 조회 5,350
13년 전 조회 2,520
13년 전 조회 3,104
13년 전 조회 2,984
13년 전 조회 1.7만
13년 전 조회 1,879
13년 전 조회 1,871
13년 전 조회 1,657
13년 전 조회 2,654
13년 전 조회 4,162
13년 전 조회 4,238
13년 전 조회 3,150
13년 전 조회 6,479
13년 전 조회 3,814
13년 전 조회 6,871
13년 전 조회 2,630
13년 전 조회 2.2만
13년 전 조회 1,868
13년 전 조회 2,408
13년 전 조회 1.8만
13년 전 조회 3,571
13년 전 조회 1,955
13년 전 조회 4,580
13년 전 조회 2,144
13년 전 조회 2,286
13년 전 조회 1,741
13년 전 조회 3,492
13년 전 조회 2,461
13년 전 조회 1,629
13년 전 조회 1,713
13년 전 조회 8,296