我有一个名为job_lists的php MySQL数据库表。样本表是:
ID | subject | description | featured | time
1 | any | any | 1 | any
2 | any | any | 0 | any
3 | any | any | 0 | any
4 | any | any | 1 | any
5 | any | any | 0 | any
6 | any | any | 1 | any
.. | ... | ... | ... | ...
如果我有数千个数据,我想以分页的方式首先加载features = 1然后加载特色= 0。
提前致谢。
答案 0 :(得分:2)
您可以在ORDER BY
ORDER BY CASE WHEN featured = 1 THEN '1'
ELSE featured = '2' END ASC
虽然在你的情况下你只需要一个后代订单
ORDER BY featured DESC