SELECT bid FROM `table` WHERE vid='233' and bid<168 ORDER BY bid desc LIMIT 6
数据表 table 下有以下字段如 bid vid ,如图:我们执行如下 SQL 查询语句:
SELECT bid FROM `table` WHERE vid='233' and bid<168 ORDER BY bid desc LIMIT 6
查询结果为:
经过字细检查才找到原因所在(看来真得老了,您看出来没?:lol)
这里顺便解释下这查询语句的意思:
SELECT bid FROM `table` WHERE vid='233' and bid<168 ORDER BY bid desc LIMIT 6
1、查询的数据表为 table :FROM `table`;
2、主要查询字段为 bid :SELECT bid ;
3、只查询条件 vid 字段的数据,并且所查询的 bid 字段值要小于168 :WHERE vid='233' and bid<168 ;
4、以 bid 为参考把查询结果以降序排序:ORDER BY bid desc (升序排序为 asc),ORDER BY 为排序,默认为升序;
5、查询结果显示6条数据:LIMIT 6 。
页:
[1]