You are correct.  Thanks! 

-----Original Message-----
From: Brad Wood [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 15, 2008 1:28 PM
To: CF-Talk
Subject: RE: SQL Question, get previous record

I think you'll want an order by on those:

to get the previous:

SELECT TOP 1 idNumber
FROM Table
WHERE idNumber < #myNumber#
ORDER BY idNumber DESC

or to get the next:

SELECT TOP 1 idNumber
FROM Table
WHERE idNumber > #myNumber#
ORDER BY idNumber ASC

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296629
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to