SQLServer ntile获取每组前10%的数据
时间:2021-06-28 08:28:46|栏目:|点击: 次
比如获取每个表的前10%个字段。
select id , name , colid , rn from (
select * , rn = ntile (10 )
over (partition by id order by colorder )
from syscolumns )t where rn = 1
复制代码 代码如下:
select id , name , colid , rn from (
select * , rn = ntile (10 )
over (partition by id order by colorder )
from syscolumns )t where rn = 1
上一篇:lua中赋值类型代码详解
栏 目:
下一篇:docker 容器上编译 go 程序提示找不到文件问题
本文标题:SQLServer ntile获取每组前10%的数据
本文地址:http://www.codeinn.net/misctech/149517.html






