MySQL的:
id | name | ------------ 1 | Joe | 2 | Craig | 3 | Shawn | 4 | Ryan | 5 | Seth |
PHP:
$a = MysqL_query("SELECT * FROM table_name ORDER BY name DESC");
我想做的是,我想从id:3开始,所以它应该输出:
3,4,5,1,2
编辑:马克是正确的.早期的查询在语法上是不正确的.
使用虚拟别名应该有效!
使用虚拟别名应该有效!
Select id from ( SELECT id FROM table_name WHERE id >= 3 ORDER BY id ASC ) X UNION Select * from ( SELECT id FROM table_name WHERE id < 3 ORDER BY id ASC ) Y
这应该给你3,2