Please start any new threads on our new site at 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
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 One record over
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 03/16/2013 :  18:47:28  Show Profile  Reply with Quote
I have a table that has 2 columns - ID, Name
I did a query and the result is records that their ID: 3,8,11,14, etc.
What is the simplest way to get the records that are in one line above - - 4,9,12,15 etc.

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 03/16/2013 :  21:23:00  Show Profile  Reply with Quote
YourTableHere AS a
INNER JOIN (YourQueryHere) AS b 
	ON a.ID = b.ID+1;
This treats your query as a blackbox. It can be simpler; if you post your query, we could suggest how it could be made simpler if possible.
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.02 seconds. Powered By: Snitz Forums 2000