4 回答
TA贡献18条经验 获得超1个赞
select * from where xx=‘xx’ and xx=‘xx’limit(开始位置,个数);
or 是 或者 多敲两遍你就会了
select * from where xx=‘xx’ or xx=‘xx’;(xx为同一字段,‘xx’为不同的值)
TA贡献9条经验 获得超4个赞
select u.username,u.photo,c.uid,sum(points) as points,p.cpost,m.comment from credit as c left join user as u on u.id=c.uid and p.category =5 left join (select uid,count(uid) as cpost from post group by uid) as p on p.uid=c.uid left join(select user_id,count(user_id) as comment from comment group by user_id) as m on m.user_id=c.uid group by c.uid order by points DESC limit 100;
今天刚碰到的,
and 和 or 表示条件;and是求交集,or求并集;
limit放在最后限制条数;
具体搜索吧;
TA贡献1条经验 获得超0个赞
<?php
$dqtime=date('y-m-d H:i:s',time());
$con = mysql_connect(数据库地址,账号,密码);
if (!$con)//判断是否正常连接数据库
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db(库名, $con);//选择库名
mysql_query("set names utf8" );//设置数据库编码
$zNum=mysql_num_rows(mysql_query("SELECT * FROM 字段名"));//判断数据库有多少数据
$right=mysql_num_rows(mysql_query("SELECT * FROM 字段名 where id=118 and money >100")); //选择ID=118 且 钱大于100的数据信息
$pass=mysql_num_rows(mysql_query("SELECT * FROM 字段名 where `当前状态`='密码错误' or id<100 order by id desc limit 5,20"));要么ID小于100 要么 密码错误的 数据信息 按照 ID 升序 排列 选择 第5 到20个
?>
添加回答
举报