oracle中的over(partition by )的用法总结
2017-09-01 15:08
239 查看
with tab as ( select t.link_pid, t.mesh, round(x, 8) x, round(y, 8) y, round(z, 8) z, id from had_link t, table(sdo_util.getvertices(t.geometry)) g ), tab1 as (select t.link_pid, t.mesh, t.x, t.y, t.z, t.id, count(*) over(partition by t.link_pid, t.x, t.y, t.z) num, row_number() over(partition by t.link_pid, t.x, t.y, t.z order by t.id) sq from tab t
在这个代码中,count(*) over (partition by t.link_pid,t.x,t.y,t.z) num的意思是以t.link_pid, t.x, t.y, t.z这4个字段进行分组,统计分组后这四个字段相同的个数。类似还有count(*) over(order by ……)、sum(amount) over(partition by ……)等,
而在row_number() over...中,记录的是以t.link_pid, t.x, t.y, t.z分组后每条数据显示的行号,以t.id进行排序。
相关文章推荐
- Oracle查询中OVER (PARTITION BY ..)用法
- oracle over (partition by )用法
- oracle over (partition by )用法
- oracle hints的用法总结
- over(Partition by...) 详细用法
- 总结下Oracle 中的Insert用法
- oracle 分析函数和开窗函数 ROW_NUMBER() OVER(PARTITION BY.....)
- ORACLE 中ROWNUM用法总结!
- Oracle开发之分析函数简介Over用法
- Oracle 语法之 OVER (PARTITION BY ..)及开窗函数
- oracle的分析函数over(Partition by...) 及开窗函数
- 浅谈oracle中row_number() over()分析函数用法
- ORACLE 中的 ROW_NUMBER() OVER() 分析函数的用法
- Oracle 分析函数 ---OVER(),row_number(),partition by
- Oracle ROWNUM用法和分页查询总结
- ORACLE 中ROWNUM用法总结
- 【转】 ORACLE 中ROWNUM用法总结
- ORACLE 中ROWNUM用法总结
- Oracle中over函数的用法
- ORACLE分析函数over(partition by...)中使用case when达到多重分组的效果