Thanks Ryan, and everyone else.
SELECT TOP 1 actualy caused an error. (I'm using mySQL)
but
<cfquery ... blockfactor="1" maxrows="1">
SELECT DISTINCT clientID
FROM crm WHERE clientID < #cid#
ORDER BY clientID DESC
</cfquery>
works perfectly.
Ricardo.
"Ryan Sabir" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
You can still use the autoIncrement to find the next and previous
records,
Just go
SELECT TOP 1 blah
FROM mytable
WHERE blahAutoID > #currentRecordID#
ORDER BY blahAutoID
for the next one, and
SELECT TOP 1 blah
FROM mytable
WHERE blahAutoID < #currentRecordID#
ORDER BY blahAutoID DESC
for the previous one.. that will get the next or previous one even if
one between has been deleted....
I think that's what you were trying to do.
bye!
Friday, March 26, 2004, 11:16:55 AM, you wrote:
RR> Morning guys...
RR> Is there a quick (and clean or dirty) way of finding the previous and
next
RR> record from a database? I would just use the auto increment to do it,
but I
RR> am not willing to trust that records won't get deleted. And I didn't
want to
RR> grab the whole table and process it.
RR> TIA
RR> Ricardo.
RR> ---
RR> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
RR> To unsubscribe send a blank email to [EMAIL PROTECTED]
RR> MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
RR> http://www.mxdu.com/ + 24-25 February, 2004
-----------------------
Ryan Sabir
Newgency Pty Ltd
2a Broughton St
Paddington 2021
Sydney, Australia
Ph (02) 9331 2133
Fax (02) 9331 5199
Mobile: 0411 512 454
http://www.newgency.com/index.cfm?referer=rysig
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004