php中的mysql语句的用法?

limit 怎么怎么使用;给个具体代码,还有配合select中and关键字和or关键字是怎么配合用的,我是个新手,希望大神们指教一下,给个具体操作代码指令

qq_幸运女神在微笑_24350621
浏览 1591回答 4
4回答

Guard丿星魂

select * from where xx=‘xx’ and  xx=‘xx’limit(开始位置,个数);or 是 或者 多敲两遍你就会了select * from where xx=‘xx’ or xx=‘xx’;(xx为同一字段,‘xx’为不同的值)

闹闹l

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放在最后限制条数;具体搜索吧;

萌家崽崽

<?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个?>
打开App,查看更多内容
随时随地看视频慕课网APP