mysql 中不区分大小写的查询 [英] not case sensitive query in mysql

查看:60
本文介绍了mysql 中不区分大小写的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要查询我的数据库并找到结果:

i need to query my database and find results :

mysql_query("select * from ".ALU_TABLE." where username like '%$q%' or name like '%$q%'");

如果我的表格中有一个名称,例如 Book 并且我在搜索框中输入 book,它不会显示该 Book

if i have a name in my table such as Book and i enter book in search box it wont show the Book

我需要查询我的数据库,因为不区分大小写.

i need to query my database as not to be case sensitive.

推荐答案

你可以使用LOWER()函数

... WHERE LOWER(username) LIKE blabl OR LOWER(name) LIKE asdasd

这篇关于mysql 中不区分大小写的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆