mysql like 검색방법

· 13년 전 · 6007 · 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,264
13년 전 조회 7,791
13년 전 조회 2,300
13년 전 조회 2,476
13년 전 조회 2,229
13년 전 조회 2,358
13년 전 조회 2,700
13년 전 조회 2,511
13년 전 조회 2,605
13년 전 조회 5,215
13년 전 조회 3,641
13년 전 조회 5,916
13년 전 조회 4,621
13년 전 조회 5,807
13년 전 조회 3,602
13년 전 조회 2,844
13년 전 조회 2,514
13년 전 조회 3,634
13년 전 조회 6,551
13년 전 조회 2,615
13년 전 조회 5,471
13년 전 조회 7,012
13년 전 조회 2,856
13년 전 조회 3,916
13년 전 조회 3,209
13년 전 조회 2,163
13년 전 조회 3,866
13년 전 조회 3,375
13년 전 조회 2,343
13년 전 조회 2,037
13년 전 조회 4,777
13년 전 조회 3,171
13년 전 조회 1,959
13년 전 조회 2,059
13년 전 조회 9,701
13년 전 조회 6,240
13년 전 조회 9,180
13년 전 조회 2,112
13년 전 조회 2,983
13년 전 조회 3,211
13년 전 조회 2,801
13년 전 조회 4,128
13년 전 조회 2,569
13년 전 조회 2,696
13년 전 조회 1,963
13년 전 조회 2,759
13년 전 조회 2,718
13년 전 조회 1.4만
13년 전 조회 2,699
13년 전 조회 6,008
13년 전 조회 3,202
13년 전 조회 2,237
13년 전 조회 2,554
13년 전 조회 5,346
13년 전 조회 2,484
13년 전 조회 6,158
13년 전 조회 2,219
13년 전 조회 2,435
13년 전 조회 2,572
13년 전 조회 1만
13년 전 조회 3,051
13년 전 조회 4,125
13년 전 조회 3,259
13년 전 조회 3,487
13년 전 조회 3,596
13년 전 조회 2,391
13년 전 조회 2,604
13년 전 조회 1.9만
13년 전 조회 3,946
13년 전 조회 5,915
13년 전 조회 3,020
13년 전 조회 3,703
13년 전 조회 3,467
13년 전 조회 1.7만
13년 전 조회 2,379
13년 전 조회 2,499
13년 전 조회 2,281
13년 전 조회 3,227
13년 전 조회 4,760
13년 전 조회 4,720
13년 전 조회 3,730
13년 전 조회 6,978
13년 전 조회 4,388
13년 전 조회 7,338
13년 전 조회 3,207
13년 전 조회 2.2만
13년 전 조회 2,442
13년 전 조회 2,959
13년 전 조회 1.8만
13년 전 조회 4,057
13년 전 조회 2,578
13년 전 조회 5,070
13년 전 조회 2,756
13년 전 조회 2,909
13년 전 조회 2,355
13년 전 조회 4,124
13년 전 조회 3,083
13년 전 조회 2,230
13년 전 조회 2,206
13년 전 조회 8,798