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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 previous value in the column
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 06/07/2005 :  07:18:43  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
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

India
22864 Posts

Posted - 06/07/2005 :  07:50:43  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Post your Sample data also

Madhivanan

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

raclede
Posting Yak Master

Philippines
180 Posts

Posted - 06/07/2005 :  21:15:58  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000