컴

mysql like 검색방법

· 2012-12-02 (일) 12:52:59 · 7280 · 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,541
13-02-15 조회 4,046
13-02-12 조회 5,824
13-02-04 조회 4,091
13-01-30 조회 4,957
13-01-25 조회 3,744
13-01-18 조회 3,769
13-01-18 조회 5,607
13-01-18 조회 6,157
13-01-18 조회 3,786
13-01-18 조회 4,845
13-01-17 조회 4,215
13-01-17 조회 3,599
13-01-17 조회 3,632
13-01-17 조회 3,975
12-12-31 조회 3,598
12-12-28 조회 4,912
12-12-28 조회 5,968
12-12-28 조회 3,414
12-12-27 조회 3,687
12-12-27 조회 4,300
12-12-20 조회 5,332
12-12-18 조회 9,151
12-12-14 조회 4,902
12-12-10 조회 3,736
12-12-10 조회 3,152
12-12-01 조회 3,941
12-11-25 조회 7,325
12-11-22 조회 5,947
12-11-20 조회 2.4만
12-11-19 조회 4,326
12-11-13 조회 3,889
12-11-12 조회 3,879
12-10-23 조회 4,818
12-09-25 조회 4,449
12-09-05 조회 7,030
12-09-04 조회 7,514
12-09-04 조회 3,432
12-08-30 조회 3,486
12-08-30 조회 3,628
12-08-29 조회 3,351
12-08-29 조회 3,192
12-08-26 조회 3,474
12-08-18 조회 3,801
12-08-17 조회 4,088
12-08-16 조회 3,623
12-08-14 조회 3,261
12-08-13 조회 5,605
12-08-13 조회 3,439
12-08-11 조회 3,747
12-08-10 조회 3,285
12-08-07 조회 4,044
12-08-07 조회 3,280
12-08-06 조회 3,482
12-07-31 조회 3,181
12-07-30 조회 3,505
12-07-30 조회 3,136
12-07-29 조회 3,314
12-07-29 조회 3,074
12-07-27 조회 3,120
12-07-21 조회 2,993
12-07-19 조회 3,210
12-07-19 조회 2,875
12-07-17 조회 3,414
12-07-17 조회 3,100
12-07-17 조회 3,969
12-07-16 조회 3,042
12-07-15 조회 3,130
12-07-14 조회 3,265
12-07-13 조회 8,321
12-07-11 조회 3,397
12-07-10 조회 9,958
12-07-09 조회 3,168
12-07-08 조회 4,420
12-07-06 조회 3,649
12-07-05 조회 3,924
12-07-05 조회 3,348
12-07-05 조회 3,306
12-07-03 조회 3,239
12-07-03 조회 3,171
12-07-02 조회 3,223
12-07-02 조회 2,920
12-06-30 조회 3,443
12-06-26 조회 3,148
12-06-22 조회 3,195
12-06-22 조회 3,146
12-06-21 조회 3,119
12-06-21 조회 3,345
12-06-20 조회 3,507
12-06-20 조회 3,172
12-06-20 조회 3,081
12-06-18 조회 3,969
12-06-17 조회 3,403
12-06-15 조회 3,014
12-06-14 조회 2,944
12-06-13 조회 3,516
12-06-11 조회 3,339
12-06-08 조회 3,347
12-06-06 조회 3,198
12-06-06 조회 3,571