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.
Author |
Topic |
ERAN185
Starting Member
1 Post |
Posted - 2013-03-16 : 18:47:28
|
HiI have a table that has 2 columns - ID, NameI 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
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-03-16 : 21:23:00
|
[code]SELECT a.ID, a.Name FROMYourTableHere AS aINNER JOIN (YourQueryHere) AS b ON a.ID = b.ID+1;[/code]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. |
|
|
|
|
|