mysql like 검색방법

· 13년 전 · 5973 · 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년 전 조회 2,172
13년 전 조회 7,702
13년 전 조회 2,198
13년 전 조회 2,378
13년 전 조회 2,139
13년 전 조회 2,264
13년 전 조회 2,604
13년 전 조회 2,443
13년 전 조회 2,519
13년 전 조회 5,116
13년 전 조회 3,549
13년 전 조회 5,818
13년 전 조회 4,519
13년 전 조회 5,704
13년 전 조회 3,498
13년 전 조회 2,743
13년 전 조회 2,424
13년 전 조회 3,540
13년 전 조회 6,454
13년 전 조회 2,582
13년 전 조회 5,433
13년 전 조회 6,977
13년 전 조회 2,764
13년 전 조회 3,879
13년 전 조회 3,118
13년 전 조회 2,087
13년 전 조회 3,779
13년 전 조회 3,346
13년 전 조회 2,258
13년 전 조회 2,005
13년 전 조회 4,708
13년 전 조회 3,087
13년 전 조회 1,932
13년 전 조회 1,983
13년 전 조회 9,597
13년 전 조회 6,155
13년 전 조회 9,146
13년 전 조회 2,085
13년 전 조회 2,906
13년 전 조회 3,170
13년 전 조회 2,712
13년 전 조회 4,097
13년 전 조회 2,482
13년 전 조회 2,619
13년 전 조회 1,934
13년 전 조회 2,679
13년 전 조회 2,683
13년 전 조회 1.4만
13년 전 조회 2,600
13년 전 조회 5,974
13년 전 조회 3,097
13년 전 조회 2,159
13년 전 조회 2,464
13년 전 조회 5,258
13년 전 조회 2,390
13년 전 조회 6,052
13년 전 조회 2,135
13년 전 조회 2,331
13년 전 조회 2,547
13년 전 조회 1만
13년 전 조회 2,974
13년 전 조회 4,043
13년 전 조회 3,178
13년 전 조회 3,391
13년 전 조회 3,496
13년 전 조회 2,358
13년 전 조회 2,566
13년 전 조회 1.9만
13년 전 조회 3,851
13년 전 조회 5,829
13년 전 조회 2,991
13년 전 조회 3,615
13년 전 조회 3,440
13년 전 조회 1.7만
13년 전 조회 2,347
13년 전 조회 2,417
13년 전 조회 2,184
13년 전 조회 3,124
13년 전 조회 4,662
13년 전 조회 4,685
13년 전 조회 3,636
13년 전 조회 6,949
13년 전 조회 4,292
13년 전 조회 7,306
13년 전 조회 3,109
13년 전 조회 2.2만
13년 전 조회 2,358
13년 전 조회 2,862
13년 전 조회 1.8만
13년 전 조회 4,023
13년 전 조회 2,483
13년 전 조회 5,034
13년 전 조회 2,675
13년 전 조회 2,820
13년 전 조회 2,255
13년 전 조회 4,013
13년 전 조회 3,005
13년 전 조회 2,152
13년 전 조회 2,180
13년 전 조회 8,769