sqlserver2005 have keywords ntile (x) and over (partition by .. order by ..) with clause.
Such as access to the top 10% of the fields in each table.
select
id
,
name
,
colid
,
rn
from(
select * , rn = ntile( 10)
over( partition by id order by colorder)
from syscolumns ) t where rn = 1
select * , rn = ntile( 10)
over( partition by id order by colorder)
from syscolumns ) t where rn = 1
Reproduced in: https: //www.cnblogs.com/kevinGao/p/3589961.html
sqlserver2005 have keywords ntile (x) and over (partition by .. order by ..) with clause.
Such as access to the top 10% of the fields in each table.
select
id
,
name
,
colid
,
rn
from(
select * , rn = ntile( 10)
over( partition by id order by colorder)
from syscolumns ) t where rn = 1
select * , rn = ntile( 10)
over( partition by id order by colorder)
from syscolumns ) t where rn = 1