mysql like 검색방법

· 13년 전 · 5473 · 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,554
13년 전 조회 7,112
13년 전 조회 1,654
13년 전 조회 1,736
13년 전 조회 1,496
13년 전 조회 1,637
13년 전 조회 1,980
13년 전 조회 1,836
13년 전 조회 1,917
13년 전 조회 4,498
13년 전 조회 2,983
13년 전 조회 5,247
13년 전 조회 3,912
13년 전 조회 5,097
13년 전 조회 2,927
13년 전 조회 2,153
13년 전 조회 1,806
13년 전 조회 2,926
13년 전 조회 5,840
13년 전 조회 2,157
13년 전 조회 5,021
13년 전 조회 6,558
13년 전 조회 2,143
13년 전 조회 3,417
13년 전 조회 2,483
13년 전 조회 1,457
13년 전 조회 3,189
13년 전 조회 2,859
13년 전 조회 1,637
13년 전 조회 1,547
13년 전 조회 4,066
13년 전 조회 2,480
13년 전 조회 1,445
13년 전 조회 1,370
13년 전 조회 8,998
13년 전 조회 5,504
13년 전 조회 8,640
13년 전 조회 1,598
13년 전 조회 2,277
13년 전 조회 2,737
13년 전 조회 2,109
13년 전 조회 3,636
13년 전 조회 1,839
13년 전 조회 1,987
13년 전 조회 1,445
13년 전 조회 2,038
13년 전 조회 2,167
13년 전 조회 1.3만
13년 전 조회 1,966
13년 전 조회 5,474
13년 전 조회 2,464
13년 전 조회 1,518
13년 전 조회 1,834
13년 전 조회 4,730
13년 전 조회 1,803
13년 전 조회 5,443
13년 전 조회 1,519
13년 전 조회 1,697
13년 전 조회 2,042
13년 전 조회 9,543
13년 전 조회 2,345
13년 전 조회 3,409
13년 전 조회 2,604
13년 전 조회 2,763
13년 전 조회 2,921
13년 전 조회 1,881
13년 전 조회 2,067
13년 전 조회 1.8만
13년 전 조회 3,234
13년 전 조회 5,267
13년 전 조회 2,513
13년 전 조회 3,010
13년 전 조회 2,980
13년 전 조회 1.7만
13년 전 조회 1,876
13년 전 조회 1,798
13년 전 조회 1,586
13년 전 조회 2,601
13년 전 조회 4,073
13년 전 조회 4,216
13년 전 조회 3,082
13년 전 조회 6,475
13년 전 조회 3,723
13년 전 조회 6,865
13년 전 조회 2,547
13년 전 조회 2.2만
13년 전 조회 1,784
13년 전 조회 2,320
13년 전 조회 1.8만
13년 전 조회 3,569
13년 전 조회 1,874
13년 전 조회 4,572
13년 전 조회 2,067
13년 전 조회 2,207
13년 전 조회 1,663
13년 전 조회 3,403
13년 전 조회 2,374
13년 전 조회 1,540
13년 전 조회 1,710
13년 전 조회 8,290