mysql like 검색방법

· 13년 전 · 5462 · 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,524
13년 전 조회 7,077
13년 전 조회 1,620
13년 전 조회 1,701
13년 전 조회 1,465
13년 전 조회 1,617
13년 전 조회 1,947
13년 전 조회 1,809
13년 전 조회 1,884
13년 전 조회 4,468
13년 전 조회 2,951
13년 전 조회 5,225
13년 전 조회 3,877
13년 전 조회 5,058
13년 전 조회 2,897
13년 전 조회 2,119
13년 전 조회 1,757
13년 전 조회 2,887
13년 전 조회 5,814
13년 전 조회 2,149
13년 전 조회 5,008
13년 전 조회 6,547
13년 전 조회 2,107
13년 전 조회 3,407
13년 전 조회 2,459
13년 전 조회 1,419
13년 전 조회 3,155
13년 전 조회 2,849
13년 전 조회 1,593
13년 전 조회 1,530
13년 전 조회 4,021
13년 전 조회 2,442
13년 전 조회 1,434
13년 전 조회 1,333
13년 전 조회 8,956
13년 전 조회 5,464
13년 전 조회 8,621
13년 전 조회 1,585
13년 전 조회 2,242
13년 전 조회 2,730
13년 전 조회 2,062
13년 전 조회 3,623
13년 전 조회 1,799
13년 전 조회 1,946
13년 전 조회 1,440
13년 전 조회 1,996
13년 전 조회 2,158
13년 전 조회 1.3만
13년 전 조회 1,927
13년 전 조회 5,463
13년 전 조회 2,418
13년 전 조회 1,479
13년 전 조회 1,777
13년 전 조회 4,695
13년 전 조회 1,757
13년 전 조회 5,403
13년 전 조회 1,484
13년 전 조회 1,645
13년 전 조회 2,037
13년 전 조회 9,535
13년 전 조회 2,305
13년 전 조회 3,367
13년 전 조회 2,576
13년 전 조회 2,730
13년 전 조회 2,876
13년 전 조회 1,869
13년 전 조회 2,058
13년 전 조회 1.8만
13년 전 조회 3,197
13년 전 조회 5,230
13년 전 조회 2,504
13년 전 조회 2,963
13년 전 조회 2,968
13년 전 조회 1.7만
13년 전 조회 1,866
13년 전 조회 1,759
13년 전 조회 1,547
13년 전 조회 2,568
13년 전 조회 4,030
13년 전 조회 4,191
13년 전 조회 3,050
13년 전 조회 6,466
13년 전 조회 3,690
13년 전 조회 6,856
13년 전 조회 2,507
13년 전 조회 2.2만
13년 전 조회 1,746
13년 전 조회 2,281
13년 전 조회 1.7만
13년 전 조회 3,553
13년 전 조회 1,832
13년 전 조회 4,561
13년 전 조회 2,030
13년 전 조회 2,155
13년 전 조회 1,622
13년 전 조회 3,353
13년 전 조회 2,329
13년 전 조회 1,501
13년 전 조회 1,706
13년 전 조회 8,284