mysql like 검색방법

· 13년 전 · 5482 · 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,663
13년 전 조회 7,210
13년 전 조회 1,731
13년 전 조회 1,852
13년 전 조회 1,622
13년 전 조회 1,761
13년 전 조회 2,068
13년 전 조회 1,965
13년 전 조회 2,025
13년 전 조회 4,605
13년 전 조회 3,083
13년 전 조회 5,358
13년 전 조회 4,034
13년 전 조회 5,204
13년 전 조회 3,028
13년 전 조회 2,264
13년 전 조회 1,923
13년 전 조회 3,044
13년 전 조회 5,961
13년 전 조회 2,162
13년 전 조회 5,029
13년 전 조회 6,568
13년 전 조회 2,243
13년 전 조회 3,424
13년 전 조회 2,591
13년 전 조회 1,575
13년 전 조회 3,298
13년 전 조회 2,866
13년 전 조회 1,759
13년 전 조회 1,553
13년 전 조회 4,199
13년 전 조회 2,596
13년 전 조회 1,451
13년 전 조회 1,482
13년 전 조회 9,110
13년 전 조회 5,623
13년 전 조회 8,647
13년 전 조회 1,609
13년 전 조회 2,374
13년 전 조회 2,740
13년 전 조회 2,237
13년 전 조회 3,647
13년 전 조회 1,949
13년 전 조회 2,108
13년 전 조회 1,452
13년 전 조회 2,151
13년 전 조회 2,177
13년 전 조회 1.3만
13년 전 조회 2,087
13년 전 조회 5,483
13년 전 조회 2,582
13년 전 조회 1,634
13년 전 조회 1,967
13년 전 조회 4,822
13년 전 조회 1,923
13년 전 조회 5,552
13년 전 조회 1,621
13년 전 조회 1,816
13년 전 조회 2,050
13년 전 조회 9,549
13년 전 조회 2,453
13년 전 조회 3,525
13년 전 조회 2,690
13년 전 조회 2,865
13년 전 조회 3,030
13년 전 조회 1,886
13년 전 조회 2,073
13년 전 조회 1.8만
13년 전 조회 3,343
13년 전 조회 5,382
13년 전 조회 2,520
13년 전 조회 3,130
13년 전 조회 2,985
13년 전 조회 1.7만
13년 전 조회 1,880
13년 전 조회 1,895
13년 전 조회 1,687
13년 전 조회 2,671
13년 전 조회 4,192
13년 전 조회 4,243
13년 전 조회 3,167
13년 전 조회 6,479
13년 전 조회 3,835
13년 전 조회 6,872
13년 전 조회 2,653
13년 전 조회 2.2만
13년 전 조회 1,896
13년 전 조회 2,432
13년 전 조회 1.8만
13년 전 조회 3,572
13년 전 조회 1,984
13년 전 조회 4,580
13년 전 조회 2,162
13년 전 조회 2,307
13년 전 조회 1,774
13년 전 조회 3,515
13년 전 조회 2,489
13년 전 조회 1,648
13년 전 조회 1,714
13년 전 조회 8,297