mysql like 검색방법

· 13년 전 · 5929 · 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,046
13년 전 조회 7,570
13년 전 조회 2,054
13년 전 조회 2,239
13년 전 조회 2,008
13년 전 조회 2,126
13년 전 조회 2,469
13년 전 조회 2,286
13년 전 조회 2,388
13년 전 조회 4,963
13년 전 조회 3,412
13년 전 조회 5,686
13년 전 조회 4,370
13년 전 조회 5,559
13년 전 조회 3,362
13년 전 조회 2,600
13년 전 조회 2,268
13년 전 조회 3,388
13년 전 조회 6,318
13년 전 조회 2,528
13년 전 조회 5,390
13년 전 조회 6,935
13년 전 조회 2,619
13년 전 조회 3,819
13년 전 조회 2,969
13년 전 조회 1,948
13년 전 조회 3,638
13년 전 조회 3,295
13년 전 조회 2,116
13년 전 조회 1,951
13년 전 조회 4,554
13년 전 조회 2,934
13년 전 조회 1,881
13년 전 조회 1,841
13년 전 조회 9,453
13년 전 조회 5,991
13년 전 조회 9,099
13년 전 조회 2,029
13년 전 조회 2,728
13년 전 조회 3,123
13년 전 조회 2,567
13년 전 조회 4,040
13년 전 조회 2,339
13년 전 조회 2,469
13년 전 조회 1,879
13년 전 조회 2,534
13년 전 조회 2,624
13년 전 조회 1.4만
13년 전 조회 2,454
13년 전 조회 5,930
13년 전 조회 2,918
13년 전 조회 2,018
13년 전 조회 2,327
13년 전 조회 5,113
13년 전 조회 2,258
13년 전 조회 5,906
13년 전 조회 1,986
13년 전 조회 2,185
13년 전 조회 2,488
13년 전 조회 1만
13년 전 조회 2,813
13년 전 조회 3,907
13년 전 조회 3,027
13년 전 조회 3,244
13년 전 조회 3,360
13년 전 조회 2,311
13년 전 조회 2,518
13년 전 조회 1.9만
13년 전 조회 3,712
13년 전 조회 5,701
13년 전 조회 2,945
13년 전 조회 3,472
13년 전 조회 3,395
13년 전 조회 1.7만
13년 전 조회 2,307
13년 전 조회 2,264
13년 전 조회 2,025
13년 전 조회 2,982
13년 전 조회 4,536
13년 전 조회 4,637
13년 전 조회 3,497
13년 전 조회 6,910
13년 전 조회 4,160
13년 전 조회 7,274
13년 전 조회 2,982
13년 전 조회 2.2만
13년 전 조회 2,228
13년 전 조회 2,743
13년 전 조회 1.8만
13년 전 조회 3,984
13년 전 조회 2,355
13년 전 조회 5,004
13년 전 조회 2,528
13년 전 조회 2,683
13년 전 조회 2,115
13년 전 조회 3,880
13년 전 조회 2,864
13년 전 조회 2,015
13년 전 조회 2,148
13년 전 조회 8,727