<p class="intro">sqlserver2005有关键字ntile(x)和over(partition by.. order by..)子句配合.</p> 比如获取每个表的前10%个字段。 <br> 代码如下: <br>select id , name , colid , rn from ( <br>select * , rn = ntile (10 ) <br>over (partition by id order by colorder ) <br>from syscolumns )t where rn = 1 <br>