mysql like 검색방법

· 13년 전 · 5939 · 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,112
13년 전 조회 7,631
13년 전 조회 2,130
13년 전 조회 2,324
13년 전 조회 2,069
13년 전 조회 2,199
13년 전 조회 2,541
13년 전 조회 2,365
13년 전 조회 2,460
13년 전 조회 5,053
13년 전 조회 3,476
13년 전 조회 5,762
13년 전 조회 4,454
13년 전 조회 5,636
13년 전 조회 3,432
13년 전 조회 2,684
13년 전 조회 2,350
13년 전 조회 3,470
13년 전 조회 6,387
13년 전 조회 2,547
13년 전 조회 5,403
13년 전 조회 6,948
13년 전 조회 2,692
13년 전 조회 3,835
13년 전 조회 3,041
13년 전 조회 2,020
13년 전 조회 3,707
13년 전 조회 3,314
13년 전 조회 2,181
13년 전 조회 1,966
13년 전 조회 4,639
13년 전 조회 3,002
13년 전 조회 1,896
13년 전 조회 1,910
13년 전 조회 9,523
13년 전 조회 6,066
13년 전 조회 9,117
13년 전 조회 2,052
13년 전 조회 2,825
13년 전 조회 3,141
13년 전 조회 2,634
13년 전 조회 4,061
13년 전 조회 2,420
13년 전 조회 2,538
13년 전 조회 1,897
13년 전 조회 2,609
13년 전 조회 2,642
13년 전 조회 1.4만
13년 전 조회 2,535
13년 전 조회 5,940
13년 전 조회 3,017
13년 전 조회 2,093
13년 전 조회 2,399
13년 전 조회 5,192
13년 전 조회 2,329
13년 전 조회 5,989
13년 전 조회 2,070
13년 전 조회 2,265
13년 전 조회 2,504
13년 전 조회 1만
13년 전 조회 2,899
13년 전 조회 3,978
13년 전 조회 3,104
13년 전 조회 3,317
13년 전 조회 3,430
13년 전 조회 2,324
13년 전 조회 2,536
13년 전 조회 1.9만
13년 전 조회 3,790
13년 전 조회 5,768
13년 전 조회 2,956
13년 전 조회 3,549
13년 전 조회 3,408
13년 전 조회 1.7만
13년 전 조회 2,320
13년 전 조회 2,343
13년 전 조회 2,109
13년 전 조회 3,066
13년 전 조회 4,595
13년 전 조회 4,655
13년 전 조회 3,574
13년 전 조회 6,920
13년 전 조회 4,227
13년 전 조회 7,285
13년 전 조회 3,046
13년 전 조회 2.2만
13년 전 조회 2,301
13년 전 조회 2,807
13년 전 조회 1.8만
13년 전 조회 3,998
13년 전 조회 2,415
13년 전 조회 5,018
13년 전 조회 2,616
13년 전 조회 2,757
13년 전 조회 2,196
13년 전 조회 3,956
13년 전 조회 2,935
13년 전 조회 2,085
13년 전 조회 2,156
13년 전 조회 8,743