Oh, I got this one on my own :)

SQL> select target, sub_target,load,
  2          case when target = prev_target and sub = prev_sub then
load - lag(load) over
(order by target, sub_target, ts) end incr_load
  3  from
  4  (select target, sub_target, ts, load, lag(target) over (order by
target, sub_target, ts) prev_target, lag(sub) over (order by
target, sub_target, ts) prev_sub
  5  from sales_data);

Thanks David for all. It was a great pleasure to work with you :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to