mysql like 검색방법

· 13년 전 · 4645 · 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년 전 조회 738
13년 전 조회 6,269
13년 전 조회 730
13년 전 조회 919
13년 전 조회 670
13년 전 조회 813
13년 전 조회 1,158
13년 전 조회 1,012
13년 전 조회 1,117
13년 전 조회 3,684
13년 전 조회 2,159
13년 전 조회 4,412
13년 전 조회 3,106
13년 전 조회 4,286
13년 전 조회 2,103
13년 전 조회 1,307
13년 전 조회 960
13년 전 조회 2,101
13년 전 조회 5,032
13년 전 조회 1,298
13년 전 조회 4,142
13년 전 조회 5,669
13년 전 조회 1,309
13년 전 조회 2,570
13년 전 조회 1,679
13년 전 조회 642
13년 전 조회 2,360
13년 전 조회 2,102
13년 전 조회 791
13년 전 조회 743
13년 전 조회 3,230
13년 전 조회 1,650
13년 전 조회 671
13년 전 조회 527
13년 전 조회 8,160
13년 전 조회 4,660
13년 전 조회 7,860
13년 전 조회 807
13년 전 조회 1,444
13년 전 조회 1,859
13년 전 조회 1,260
13년 전 조회 2,767
13년 전 조회 975
13년 전 조회 1,188
13년 전 조회 677
13년 전 조회 1,207
13년 전 조회 1,389
13년 전 조회 1.3만
13년 전 조회 1,114
13년 전 조회 4,646
13년 전 조회 1,623
13년 전 조회 671
13년 전 조회 959
13년 전 조회 3,771
13년 전 조회 946
13년 전 조회 4,600
13년 전 조회 690
13년 전 조회 848
13년 전 조회 1,254
13년 전 조회 8,780
13년 전 조회 1,498
13년 전 조회 2,528
13년 전 조회 1,679
13년 전 조회 1,941
13년 전 조회 2,025
13년 전 조회 1,096
13년 전 조회 1,289
13년 전 조회 1.8만
13년 전 조회 2,351
13년 전 조회 4,380
13년 전 조회 1,704
13년 전 조회 2,126
13년 전 조회 2,181
13년 전 조회 1.6만
13년 전 조회 1,104
13년 전 조회 959
13년 전 조회 745
13년 전 조회 1,639
13년 전 조회 3,222
13년 전 조회 3,457
13년 전 조회 2,141
13년 전 조회 5,678
13년 전 조회 2,836
13년 전 조회 6,043
13년 전 조회 1,652
13년 전 조회 2.1만
13년 전 조회 926
13년 전 조회 1,425
13년 전 조회 1.7만
13년 전 조회 2,805
13년 전 조회 1,047
13년 전 조회 3,761
13년 전 조회 1,210
13년 전 조회 1,364
13년 전 조회 813
13년 전 조회 2,544
13년 전 조회 1,530
13년 전 조회 680
13년 전 조회 928
13년 전 조회 7,493
🐛 버그신고