SQL Server Forums
Profile | Register | 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
 New Topic  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
22713 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  
 New 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.05 seconds. Powered By: Snitz Forums 2000