SELECT * FROM (SELECT TOP 10 * FROM FooTable ORDER BY X DESC) ORDER BY X ASC
例如,列X可以是ID或时间戳;我想要最新的10条记录,但希望它们按照时间顺序返回.
SELECT * FROM (SELECT TOP 10 * FROM FooTable ORDER BY X DESC) as myAlias ORDER BY X ASC
即你的子查询可能需要一个别名,但除此之外它应该有效.