2016-10-22 85 views

回答

0

你應該學會的Teradata OLAP Functions..and嘗試如下: -

select COL1,COL2 , 
    coalesce(min(col2) over (partition by col1 order by col2 rows between 1 preceding and 1 preceding), 0) as prv_value 
col2-prv_value as diff 
    from TEMP 
相關問題