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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Can This be Done In SQL?

Author  Topic 

andre
Constraint Violating Yak Guru

259 Posts

Posted - 2001-07-03 : 12:46:12
I have a web page that displays a JPG image and has links to view the next and previous images. Let's say I also have a table like this:

ID Filename
---------------
1 img001.jpg
2 img002.jpg
3 img003.jpg

and the page uses this query: SELECT Filename FROM tblImage WHERE ID=2

Can I get the next and previous ID and get this result using SQL?:

Filename: img002.jpg Previous ID: 1 Next ID: 3

   

- Advertisement -