sqlserver2005有关键字ntile(x)和over(partition by.. order by..)子句配合.

比如获取每个表的前10%个字段。

selectid,name,colid,rnfrom(
select*,rn=ntile(10)
over(partitionbyidorderbycolorder)
fromsyscolumns )twherern=1
更多 0