您的位置:首页 > 数据库 > MySQL

mysql like语句

2015-08-06 16:50 771 查看
数据库模糊查询like语句:
$sql = "select * from table where title like '%中国%'";
//包含“中国”两个字
$sql = "select * from table where title like '中国%'";
//以“中国”开头
$sql = "select * from table where title like '%中国'";
//以“中国”结尾
$sql = "select * from table where title like '[ALN]%'";
//以A、L、N开头
$sql = "select * from table where title like '%[ALN]'";
//以A、L、N结尾
$sql = "select * from table where title like '[!ALN]%'";
//不以A、L、N开头

in语句:
$sql = "select * from table where name in ('张','梁');
//获取name等于“张”或者“梁”的信息

mysql_num_rows()
//获取结果集中行的数

ceil() //向上取整数
floor()
//向下取整数

mysql教程:http://www.w3school.com.cn/sql/index.asp
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: