mysql like 검색방법

· 13년 전 · 5471 · 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,538
13년 전 조회 7,088
13년 전 조회 1,635
13년 전 조회 1,719
13년 전 조회 1,477
13년 전 조회 1,631
13년 전 조회 1,963
13년 전 조회 1,821
13년 전 조회 1,901
13년 전 조회 4,482
13년 전 조회 2,967
13년 전 조회 5,238
13년 전 조회 3,893
13년 전 조회 5,077
13년 전 조회 2,917
13년 전 조회 2,136
13년 전 조회 1,776
13년 전 조회 2,903
13년 전 조회 5,827
13년 전 조회 2,153
13년 전 조회 5,018
13년 전 조회 6,554
13년 전 조회 2,127
13년 전 조회 3,415
13년 전 조회 2,472
13년 전 조회 1,433
13년 전 조회 3,173
13년 전 조회 2,858
13년 전 조회 1,613
13년 전 조회 1,539
13년 전 조회 4,046
13년 전 조회 2,460
13년 전 조회 1,441
13년 전 조회 1,351
13년 전 조회 8,971
13년 전 조회 5,484
13년 전 조회 8,630
13년 전 조회 1,594
13년 전 조회 2,263
13년 전 조회 2,733
13년 전 조회 2,083
13년 전 조회 3,627
13년 전 조회 1,821
13년 전 조회 1,965
13년 전 조회 1,443
13년 전 조회 2,014
13년 전 조회 2,164
13년 전 조회 1.3만
13년 전 조회 1,947
13년 전 조회 5,472
13년 전 조회 2,441
13년 전 조회 1,499
13년 전 조회 1,801
13년 전 조회 4,713
13년 전 조회 1,779
13년 전 조회 5,420
13년 전 조회 1,503
13년 전 조회 1,668
13년 전 조회 2,041
13년 전 조회 9,540
13년 전 조회 2,324
13년 전 조회 3,390
13년 전 조회 2,590
13년 전 조회 2,746
13년 전 조회 2,901
13년 전 조회 1,879
13년 전 조회 2,063
13년 전 조회 1.8만
13년 전 조회 3,216
13년 전 조회 5,244
13년 전 조회 2,511
13년 전 조회 2,990
13년 전 조회 2,976
13년 전 조회 1.7만
13년 전 조회 1,874
13년 전 조회 1,774
13년 전 조회 1,567
13년 전 조회 2,580
13년 전 조회 4,052
13년 전 조회 4,201
13년 전 조회 3,065
13년 전 조회 6,472
13년 전 조회 3,705
13년 전 조회 6,862
13년 전 조회 2,530
13년 전 조회 2.2만
13년 전 조회 1,764
13년 전 조회 2,295
13년 전 조회 1.8만
13년 전 조회 3,561
13년 전 조회 1,851
13년 전 조회 4,568
13년 전 조회 2,047
13년 전 조회 2,180
13년 전 조회 1,645
13년 전 조회 3,377
13년 전 조회 2,352
13년 전 조회 1,516
13년 전 조회 1,709
13년 전 조회 8,289