컴

mysql like 검색방법

· 2012-12-02 (일) 12:52:59 · 7246 · 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개

2012-12-02 (일) 13:00:46
감사요
ㅎ 그렇군요..
2012-12-08 (토) 19:36:19
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
감사합니다
2012-12-14 (금) 00:53:42
감사합니다
감사합니다
감사합니다
감사합니다.
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
13-02-18 조회 3,519
13-02-15 조회 3,955
13-02-12 조회 5,803
13-02-04 조회 4,079
13-01-30 조회 4,938
13-01-25 조회 3,712
13-01-18 조회 3,757
13-01-18 조회 5,513
13-01-18 조회 6,134
13-01-18 조회 3,779
13-01-18 조회 4,751
13-01-17 조회 4,093
13-01-17 조회 3,579
13-01-17 조회 3,627
13-01-17 조회 3,966
12-12-31 조회 3,562
12-12-28 조회 4,902
12-12-28 조회 5,960
12-12-28 조회 3,403
12-12-27 조회 3,604
12-12-27 조회 4,283
12-12-20 조회 5,242
12-12-18 조회 9,084
12-12-14 조회 4,890
12-12-10 조회 3,660
12-12-10 조회 3,122
12-12-01 조회 3,825
12-11-25 조회 7,305
12-11-22 조회 5,916
12-11-20 조회 2.4만
12-11-19 조회 4,314
12-11-13 조회 3,874
12-11-12 조회 3,869
12-10-23 조회 4,720
12-09-25 조회 4,361
12-09-05 조회 6,947
12-09-04 조회 7,504
12-09-04 조회 3,420
12-08-30 조회 3,410
12-08-30 조회 3,613
12-08-29 조회 3,336
12-08-29 조회 3,160
12-08-26 조회 3,464
12-08-18 조회 3,736
12-08-17 조회 3,996
12-08-16 조회 3,555
12-08-14 조회 3,191
12-08-13 조회 5,590
12-08-13 조회 3,356
12-08-11 조회 3,653
12-08-10 조회 3,220
12-08-07 조회 3,973
12-08-07 조회 3,201
12-08-06 조회 3,421
12-07-31 조회 3,172
12-07-30 조회 3,496
12-07-30 조회 3,125
12-07-29 조회 3,301
12-07-29 조회 3,051
12-07-27 조회 3,107
12-07-21 조회 2,978
12-07-19 조회 3,188
12-07-19 조회 2,784
12-07-17 조회 3,406
12-07-17 조회 3,056
12-07-17 조회 3,955
12-07-16 조회 2,999
12-07-15 조회 3,118
12-07-14 조회 3,178
12-07-13 조회 8,265
12-07-11 조회 3,387
12-07-10 조회 9,947
12-07-09 조회 3,160
12-07-08 조회 4,342
12-07-06 조회 3,634
12-07-05 조회 3,912
12-07-05 조회 3,331
12-07-05 조회 3,224
12-07-03 조회 3,223
12-07-03 조회 3,164
12-07-02 조회 3,216
12-07-02 조회 2,834
12-06-30 조회 3,435
12-06-26 조회 3,142
12-06-22 조회 3,183
12-06-22 조회 3,134
12-06-21 조회 3,104
12-06-21 조회 3,331
12-06-20 조회 3,496
12-06-20 조회 3,162
12-06-20 조회 3,069
12-06-18 조회 3,952
12-06-17 조회 3,385
12-06-15 조회 3,003
12-06-14 조회 2,918
12-06-13 조회 3,506
12-06-11 조회 3,326
12-06-08 조회 3,319
12-06-06 조회 3,172
12-06-06 조회 3,556