![](/img/trans.png)
[英]I want Distinct value from a column and orderby another column from a mysql database
[英]I want to ascend and decend MYSQL from a value in the database
我想从数据库中的值提升MYSQL。 假设:具有表tbl_numbers
列号的数据库中的10个值是1-10。 我想要:
order by numbers desc {from 8} LIMIT 3
它会显示
8
7
6
代替:
order by numbers desc LIMIT 3
10
9
8
如果这是可能的,那么什么php而不是mysql也很好。
--update! -
我给的示例很简单,我真的需要将date()与数据库中条目的日期匹配,然后从那里开始升序或降序吗? 日期格式为2010-06-18
ORDER BY numbers DESC
LIMIT 3,3
限制的第一个参数是(10个条目+ 1)-3; 第二个参数是要返回的记录数
或者:
WHERE numbers <= 8
ORDER BY numbers DESC
LIMIT 3
遵循以下原则
ORDER BY (numbers < 8) DESC, numbers DESC LIMIT 3
应该做的工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.