我有像这样的Mysql数据库
id name
1 very big
2 very big
3 big
4 big
5 small
6 small
我想像这样订购我的数据库
id name
1 very big
3 big
5 small
6 small
4 big
2 very big
或者像这样:
id name
2 very big
4 big
6 small
5 small
3 big
1 very big
(indeed sorting from 123456 to 135642 )
我怎么能用php或mysql做到?
答案 0 :(得分:1)
你可以这样做:
order by id % 2,
(case when id % 2 = 0 then id end) asc
id desc;