Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 previous value in the column

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-06-07 : 07:18:43
Lubomir writes "If you write following SELECT in ORACLE:

select l.*,
lag(week,1) as prev_week
from MI_Risk..lu_row l


You will obtain this result:

NAME WEEK PREV_WEEK
-------------------------------------------------
mike 1 NULL
mike 2 1
mike 3 2
mike 4 3


How to write similar select in SQL Server environment, please?
Thanks
Lubomir"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-06-07 : 07:50:43
Post your Sample data also

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

raclede
Posting Yak Master

180 Posts

Posted - 2005-06-07 : 21:15:58
what does lag mean?

"If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year, killing everyone inside. "

raclede
Go to Top of Page
   

- Advertisement -