赞
踩
- 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进行排序。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。