mysql like 검색방법

· 13년 전 · 5676 · 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,826
13년 전 조회 7,367
13년 전 조회 1,848
13년 전 조회 2,011
13년 전 조회 1,775
13년 전 조회 1,922
13년 전 조회 2,235
13년 전 조회 2,096
13년 전 조회 2,174
13년 전 조회 4,754
13년 전 조회 3,218
13년 전 조회 5,497
13년 전 조회 4,163
13년 전 조회 5,358
13년 전 조회 3,171
13년 전 조회 2,399
13년 전 조회 2,075
13년 전 조회 3,177
13년 전 조회 6,105
13년 전 조회 2,309
13년 전 조회 5,163
13년 전 조회 6,693
13년 전 조회 2,389
13년 전 조회 3,583
13년 전 조회 2,732
13년 전 조회 1,715
13년 전 조회 3,439
13년 전 조회 3,049
13년 전 조회 1,912
13년 전 조회 1,710
13년 전 조회 4,311
13년 전 조회 2,728
13년 전 조회 1,637
13년 전 조회 1,632
13년 전 조회 9,239
13년 전 조회 5,773
13년 전 조회 8,828
13년 전 조회 1,797
13년 전 조회 2,520
13년 전 조회 2,894
13년 전 조회 2,380
13년 전 조회 3,801
13년 전 조회 2,111
13년 전 조회 2,267
13년 전 조회 1,635
13년 전 조회 2,315
13년 전 조회 2,397
13년 전 조회 1.4만
13년 전 조회 2,234
13년 전 조회 5,677
13년 전 조회 2,740
13년 전 조회 1,792
13년 전 조회 2,112
13년 전 조회 4,931
13년 전 조회 2,064
13년 전 조회 5,690
13년 전 조회 1,787
13년 전 조회 1,963
13년 전 조회 2,222
13년 전 조회 9,806
13년 전 조회 2,604
13년 전 조회 3,716
13년 전 조회 2,824
13년 전 조회 3,008
13년 전 조회 3,166
13년 전 조회 2,073
13년 전 조회 2,270
13년 전 조회 1.9만
13년 전 조회 3,499
13년 전 조회 5,512
13년 전 조회 2,725
13년 전 조회 3,271
13년 전 조회 3,132
13년 전 조회 1.7만
13년 전 조회 2,051
13년 전 조회 2,047
13년 전 조회 1,833
13년 전 조회 2,768
13년 전 조회 4,316
13년 전 조회 4,421
13년 전 조회 3,306
13년 전 조회 6,667
13년 전 조회 3,967
13년 전 조회 7,047
13년 전 조회 2,793
13년 전 조회 2.2만
13년 전 조회 2,053
13년 전 조회 2,563
13년 전 조회 1.8만
13년 전 조회 3,749
13년 전 조회 2,122
13년 전 조회 4,762
13년 전 조회 2,310
13년 전 조회 2,474
13년 전 조회 1,905
13년 전 조회 3,670
13년 전 조회 2,654
13년 전 조회 1,796
13년 전 조회 1,895
13년 전 조회 8,463