标签: sql sql-server-2012
我使用此代码从表中选择最后5行:
SELECT TOP(5) * FROM tbl_reg ORDER BY Id DESC
但我想重新排序此结果(返回的最后五行)由Id ASC
我该怎么做?
答案 0 :(得分:2)
使用子查询:
select t.* from (SELECT TOP(5) * FROM tbl_reg ORDER BY Id DESC) t order by id ASC;