Home > database >  Oracle - SQL statement, calculate year-on-year annulus
Oracle - SQL statement, calculate year-on-year annulus

Time:10-20



Select
B.y un_id,
B.y un_yaerm,
B.a mount,
B.y un_name,
B.H B,
B.t b,
C.a. mount,
C.y un_yaerm,
NVL (round ((c.a. mount - b.a mount)/b.a mount, 2), 0),
Da mount,
D.y un_yaerm,
NVL (round (da mount - b.a (mount)/b.a mount, 2), 0)
The from lichengyun b
Left the join
Lichengyun c on
To_date (b.y un_yaerm, '- dd yyyy - mm)=add_months (to_date (c.y un_yaerm,' - dd yyyy - mm), 1)
Left the join
Lichengyun d on
To_date (b.y un_yaerm, '- dd yyyy - mm)=add_months (to_date (d.y un_yaerm,' - dd yyyy - mm), and 12)








CodePudding user response:

If it's 1, 10 g version later, can see the analysis function (window function);
2, also can with the as built temporary tables in different years,
  • Related