var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: qry reg LAG
how can i get 2 or more colums of the previous record using the lag function
ie, any other equivalent for the below..... hope the below one is not efficient..not even sure wheather it works... pls suggest a way
select a,b,lag(a,1) over (order by c,d) prev_a, lag(b,1) over (order by c,d) prev_b from ....
the order by remains the same...
Youve answered your own question. LAG cannot retrieve multiple columns so you just use LAG multiple times ensuring you have the same order by.
ok Alan, what abt the performance...... does oracle execute the order by multiple times???????
Well I havent tried it but I suspect not. Why not try a query with a single LAG function followed by another query with two and look at the execution plans. Also look at the stats generated by putting tracing on.