日期:2014-05-17 浏览次数:20485 次
select top 10 * from (select top 20 * from Idea order by id asc) a order by id desc
------解决方案--------------------
--动态双TOP写法 declare @col varchar(300),@sql varchar(max) select @col=isnull(@col+',','')+name from syscolumns where id=object_id('Idea') set @sql='select top 10 '+@col+' from (select top 20 '+@col+' from Idea order by id asc) a order by id desc' exec(@sql)