It sounds like the subselect meets your needs better as you are getting a single record from the database... however It turns out otherwise then You could also use coldfusion to grab the id before and after like so when looping through the query:
<cfquery name="theQuery"> select id, title from table order by id </cfquery> <cfloutput query="theQuery"> #id# - #title# <cfif theQuery.currentrow is not 0> previous id = #theQuery[theQuery.currentrow-1].id# </cfif> <cfif theQuer.currentrow is lt theQuery.numrecords> next id = #theQuery[theQuery.currentrow+1].id# </cfif> </cfoutput> Not that i'm a walking compiler... But I believe that should also get you your results. -- [EMAIL PROTECTED] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:196903 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54