COMING SOON 🚀

mysql like 검색방법

· 13년 전 · 5882 · 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,959
13년 전 조회 7,486
13년 전 조회 1,974
13년 전 조회 2,153
13년 전 조회 1,927
13년 전 조회 2,051
13년 전 조회 2,363
13년 전 조회 2,210
13년 전 조회 2,311
13년 전 조회 4,872
13년 전 조회 3,340
13년 전 조회 5,620
13년 전 조회 4,287
13년 전 조회 5,476
13년 전 조회 3,296
13년 전 조회 2,513
13년 전 조회 2,196
13년 전 조회 3,306
13년 전 조회 6,232
13년 전 조회 2,476
13년 전 조회 5,346
13년 전 조회 6,894
13년 전 조회 2,527
13년 전 조회 3,773
13년 전 조회 2,874
13년 전 조회 1,850
13년 전 조회 3,557
13년 전 조회 3,250
13년 전 조회 2,031
13년 전 조회 1,916
13년 전 조회 4,465
13년 전 조회 2,856
13년 전 조회 1,835
13년 전 조회 1,755
13년 전 조회 9,386
13년 전 조회 5,905
13년 전 조회 9,050
13년 전 조회 1,990
13년 전 조회 2,638
13년 전 조회 3,069
13년 전 조회 2,485
13년 전 조회 4,005
13년 전 조회 2,243
13년 전 조회 2,385
13년 전 조회 1,831
13년 전 조회 2,440
13년 전 조회 2,578
13년 전 조회 1.4만
13년 전 조회 2,363
13년 전 조회 5,883
13년 전 조회 2,848
13년 전 조회 1,920
13년 전 조회 2,242
13년 전 조회 5,033
13년 전 조회 2,175
13년 전 조회 5,823
13년 전 조회 1,905
13년 전 조회 2,099
13년 전 조회 2,444
13년 전 조회 9,992
13년 전 조회 2,718
13년 전 조회 3,823
13년 전 조회 2,949
13년 전 조회 3,152
13년 전 조회 3,281
13년 전 조회 2,261
13년 전 조회 2,472
13년 전 조회 1.9만
13년 전 조회 3,626
13년 전 조회 5,622
13년 전 조회 2,912
13년 전 조회 3,382
13년 전 조회 3,342
13년 전 조회 1.7만
13년 전 조회 2,261
13년 전 조회 2,173
13년 전 조회 1,942
13년 전 조회 2,891
13년 전 조회 4,444
13년 전 조회 4,604
13년 전 조회 3,422
13년 전 조회 6,857
13년 전 조회 4,071
13년 전 조회 7,236
13년 전 조회 2,897
13년 전 조회 2.2만
13년 전 조회 2,164
13년 전 조회 2,669
13년 전 조회 1.8만
13년 전 조회 3,935
13년 전 조회 2,262
13년 전 조회 4,964
13년 전 조회 2,433
13년 전 조회 2,594
13년 전 조회 2,026
13년 전 조회 3,785
13년 전 조회 2,784
13년 전 조회 1,941
13년 전 조회 2,105
13년 전 조회 8,679