mysql 查询语句区分大小写

一、查询语句上加binary

SELECT a.DOCU_CODE '单一窗口编号', b.DOCU_CODE '本地编号',a.DOCU_NAME '单一窗口名称',b.DOCU_NAME '本地名称'
  from licensedocu a,licensedocu_copy b
 where binary a.DOCU_CODE = b.DOCU_CODE
   and a.DOCU_NAME != b.DOCU_NAME

二、建表时加binary

create table t {
    code varchar(10)  binary
}
ALTER TABLE t_order CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;

执行完上面的sql后,对该表的查询就能区分大小写了

posted @ 2024-02-29 14:29  薛柏梁  阅读(315)  评论(0编辑  收藏  举报