qadsam
asked on
lag function
I am trying to accomplish lag function, over and last value, first value in sql server 2005.
Can you please help.
Query from oracle i wanted to convert to sql server
100*((reads- nvl(lag(reads,1)over(order by snap_id),reads)) /
(last_value(reads)over(ord er by 1)-first_value(reads)over( order by 1))) Reads
Thanks,
sam
Can you please help.
Query from oracle i wanted to convert to sql server
100*((reads- nvl(lag(reads,1)over(order
(last_value(reads)over(ord
Thanks,
sam
100*((reads- nvl(lag(reads,1)over(order by snap_id),reads)) /
(last_value(reads)over(order by 1)-first_value(reads)over(order by 1))) PRD,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Solution found
Thanks,
Thanks,
As far as I am aware, SQL Server has not implemented the LEAD or LAG functions. This might help http://rafael-salas.blogspot.com/2008/05/t-sql-lead-and-lag-functions.html
lwadwell