mysql like 검색방법

· 13년 전 · 5465 · 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,529
13년 전 조회 7,079
13년 전 조회 1,625
13년 전 조회 1,710
13년 전 조회 1,468
13년 전 조회 1,620
13년 전 조회 1,954
13년 전 조회 1,813
13년 전 조회 1,891
13년 전 조회 4,470
13년 전 조회 2,954
13년 전 조회 5,232
13년 전 조회 3,881
13년 전 조회 5,064
13년 전 조회 2,908
13년 전 조회 2,124
13년 전 조회 1,760
13년 전 조회 2,891
13년 전 조회 5,819
13년 전 조회 2,150
13년 전 조회 5,010
13년 전 조회 6,551
13년 전 조회 2,113
13년 전 조회 3,408
13년 전 조회 2,461
13년 전 조회 1,423
13년 전 조회 3,162
13년 전 조회 2,855
13년 전 조회 1,601
13년 전 조회 1,533
13년 전 조회 4,031
13년 전 조회 2,448
13년 전 조회 1,440
13년 전 조회 1,339
13년 전 조회 8,958
13년 전 조회 5,470
13년 전 조회 8,625
13년 전 조회 1,589
13년 전 조회 2,248
13년 전 조회 2,732
13년 전 조회 2,066
13년 전 조회 3,625
13년 전 조회 1,806
13년 전 조회 1,951
13년 전 조회 1,440
13년 전 조회 2,002
13년 전 조회 2,158
13년 전 조회 1.3만
13년 전 조회 1,933
13년 전 조회 5,466
13년 전 조회 2,422
13년 전 조회 1,487
13년 전 조회 1,783
13년 전 조회 4,699
13년 전 조회 1,765
13년 전 조회 5,408
13년 전 조회 1,490
13년 전 조회 1,651
13년 전 조회 2,039
13년 전 조회 9,536
13년 전 조회 2,312
13년 전 조회 3,372
13년 전 조회 2,579
13년 전 조회 2,735
13년 전 조회 2,887
13년 전 조회 1,872
13년 전 조회 2,059
13년 전 조회 1.8만
13년 전 조회 3,203
13년 전 조회 5,237
13년 전 조회 2,506
13년 전 조회 2,968
13년 전 조회 2,969
13년 전 조회 1.7만
13년 전 조회 1,868
13년 전 조회 1,761
13년 전 조회 1,550
13년 전 조회 2,570
13년 전 조회 4,037
13년 전 조회 4,194
13년 전 조회 3,054
13년 전 조회 6,468
13년 전 조회 3,695
13년 전 조회 6,859
13년 전 조회 2,514
13년 전 조회 2.2만
13년 전 조회 1,749
13년 전 조회 2,285
13년 전 조회 1.7만
13년 전 조회 3,557
13년 전 조회 1,839
13년 전 조회 4,565
13년 전 조회 2,033
13년 전 조회 2,162
13년 전 조회 1,626
13년 전 조회 3,361
13년 전 조회 2,335
13년 전 조회 1,507
13년 전 조회 1,706
13년 전 조회 8,286