mysql like 검색방법

· 13년 전 · 5943 · 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,118
13년 전 조회 7,640
13년 전 조회 2,137
13년 전 조회 2,335
13년 전 조회 2,084
13년 전 조회 2,210
13년 전 조회 2,552
13년 전 조회 2,373
13년 전 조회 2,469
13년 전 조회 5,065
13년 전 조회 3,490
13년 전 조회 5,769
13년 전 조회 4,467
13년 전 조회 5,646
13년 전 조회 3,443
13년 전 조회 2,692
13년 전 조회 2,358
13년 전 조회 3,479
13년 전 조회 6,402
13년 전 조회 2,548
13년 전 조회 5,405
13년 전 조회 6,950
13년 전 조회 2,702
13년 전 조회 3,841
13년 전 조회 3,057
13년 전 조회 2,029
13년 전 조회 3,714
13년 전 조회 3,317
13년 전 조회 2,191
13년 전 조회 1,969
13년 전 조회 4,647
13년 전 조회 3,015
13년 전 조회 1,900
13년 전 조회 1,922
13년 전 조회 9,532
13년 전 조회 6,076
13년 전 조회 9,119
13년 전 조회 2,056
13년 전 조회 2,843
13년 전 조회 3,141
13년 전 조회 2,649
13년 전 조회 4,064
13년 전 조회 2,427
13년 전 조회 2,551
13년 전 조회 1,901
13년 전 조회 2,617
13년 전 조회 2,647
13년 전 조회 1.4만
13년 전 조회 2,543
13년 전 조회 5,944
13년 전 조회 3,030
13년 전 조회 2,101
13년 전 조회 2,408
13년 전 조회 5,198
13년 전 조회 2,343
13년 전 조회 6,000
13년 전 조회 2,081
13년 전 조회 2,274
13년 전 조회 2,508
13년 전 조회 1만
13년 전 조회 2,914
13년 전 조회 3,987
13년 전 조회 3,118
13년 전 조회 3,329
13년 전 조회 3,439
13년 전 조회 2,325
13년 전 조회 2,538
13년 전 조회 1.9만
13년 전 조회 3,800
13년 전 조회 5,778
13년 전 조회 2,959
13년 전 조회 3,553
13년 전 조회 3,409
13년 전 조회 1.7만
13년 전 조회 2,321
13년 전 조회 2,353
13년 전 조회 2,119
13년 전 조회 3,074
13년 전 조회 4,602
13년 전 조회 4,656
13년 전 조회 3,583
13년 전 조회 6,927
13년 전 조회 4,242
13년 전 조회 7,288
13년 전 조회 3,056
13년 전 조회 2.2만
13년 전 조회 2,309
13년 전 조회 2,817
13년 전 조회 1.8만
13년 전 조회 4,000
13년 전 조회 2,432
13년 전 조회 5,019
13년 전 조회 2,621
13년 전 조회 2,769
13년 전 조회 2,205
13년 전 조회 3,966
13년 전 조회 2,947
13년 전 조회 2,094
13년 전 조회 2,158
13년 전 조회 8,746