分类: Oracle
2013-01-23 16:46:55
分析函数语法:
function_name(
partition 子句表示分组
order by 排序
winding
例如
1.lead,lag 获取当前行后面/前面某行的数据
select c_fundcode,
d_cdate,
f_netvalue,
f_income,
lead(f_netvalue) over(partition by c_fundcode order by d_cdate desc) pre_netvalue,
lead(f_income) over(partition by c_fundcode order by d_cdate desc) pre_income
from tfundday;
上面查询语句中pre_netvalue表示确认日期上一天的单位净值