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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-04-23 : 09:02:55
|
| Andris writes "HelloI have a specific situation:Imagine that i have a database with records. Then I retrieve a record with specific number, but a query should return me the next record. For instance, if I have a database with records 1,2,3,4,5 and I write SELECT * FROM table WHERE ID=1The query would return a record with ID number 1. But how could I make a query to retrieve not record with ID 1, but record with ID 2. The most important point is that some ID numbers in my database are missing. For example 1,2,3,5 (4 is missing).Hope You could help meAndris[I have WINNT and SQL SERVER 2000]" |
|
|
Nazim
A custom title
1408 Posts |
Posted - 2002-04-23 : 09:08:09
|
| select top 1 * from tablenamewhere id > 1order by id ascHTH-------------------------------------------------------------- |
 |
|
|
|
|
|