![](/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.