컴

mysql like 검색방법

· 2012-12-02 (일) 12:52:59 · 7387 · 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
감사합니다
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
13-03-03 조회 6,215
13-03-01 조회 5,547
13-03-01 조회 8,282
13-03-01 조회 6,256
13-02-26 조회 3,871
13-02-26 조회 3,824
13-02-26 조회 4,712
13-02-24 조회 8,152
13-02-24 조회 4,230
13-02-24 조회 3,483
13-02-24 조회 5,285
13-02-24 조회 5,284
13-02-24 조회 4,352
13-02-24 조회 5,692
13-02-24 조회 9,377
13-02-14 조회 5,073
13-02-13 조회 8,996
13-01-29 조회 7,645
13-01-24 조회 5,003
13-01-24 조회 4,877
13-01-17 조회 4,279
13-01-16 조회 4,299
13-01-08 조회 4,375
12-12-27 조회 4,031
12-12-20 조회 1.1만
12-12-20 조회 3,355
12-12-06 조회 4,342
12-12-01 조회 4,090
12-11-28 조회 5,656
12-11-25 조회 5,370
12-10-20 조회 4,636
12-10-03 조회 4,787
12-09-26 조회 4,977
12-09-15 조회 8,420
12-09-14 조회 5,439
12-09-11 조회 3,928
12-09-10 조회 3,961
12-09-05 조회 8,834
12-08-29 조회 4,610
12-08-26 조회 3,751
12-08-23 조회 3,458
12-08-22 조회 3,532
12-08-22 조회 4,345
12-08-21 조회 3,497
12-08-20 조회 3,423
12-08-20 조회 9,232
12-08-15 조회 4,344
12-08-13 조회 3,265
12-08-11 조회 4,676
12-08-05 조회 4,527
12-08-03 조회 3,306
12-08-03 조회 4,004
12-08-02 조회 4,986
12-07-29 조회 4,096
12-07-26 조회 3,678
12-07-26 조회 3,551
12-07-22 조회 3,455
12-07-20 조회 3,291
12-07-19 조회 4,159
12-07-19 조회 3,416
12-07-16 조회 3,538
12-07-16 조회 4,455
12-07-15 조회 3,511
12-07-12 조회 7,354
12-07-12 조회 5,003
12-07-11 조회 3,034
12-07-09 조회 3,212
12-07-05 조회 3,815
12-07-04 조회 4,395
12-07-04 조회 3,801
12-07-04 조회 4,333
12-06-29 조회 3,778
12-06-27 조회 3,361
12-06-24 조회 3,837
12-06-22 조회 4,147
12-06-22 조회 8,564
12-06-22 조회 3,224
12-06-21 조회 3,242
12-06-17 조회 3,867
12-06-14 조회 3,967
12-06-14 조회 3,251
12-06-08 조회 4,411
12-06-06 조회 3,361
12-06-04 조회 4,112
12-05-26 조회 4,956
12-05-26 조회 3,900
12-05-25 조회 3,192
12-05-24 조회 3,290
12-05-22 조회 3,333
12-05-20 조회 2,969
12-05-16 조회 3,111
12-05-15 조회 3,504
12-05-10 조회 3,938
12-05-08 조회 3,453
12-05-04 조회 3,304
12-05-03 조회 4,247
12-05-02 조회 3,401
12-05-02 조회 3,154
12-05-02 조회 3,266
12-04-26 조회 3,414