If you know that your items are sequential, you can simply pass the previous value or the next value in the link or the form. Otherwise, you can use something like this query in MS SQL Server (not sure about Access or Oracle) to draw your next up or down item SELECT TOP 1 * FROM promotions WHERE orderindex < #orderindex# ORDER BY orderindex DESC That will get the next one with a smaller order number To get the next one with a larger order number, reverse your where clause and order by ASC hth Isaac


------ Original Message ------
Wrom: CONEUQZAAFXISHJEXXIMQZUIVOTQNQEMSF To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
CC:
Sent: Sep 06, 2002 07:10 PM
Subject: Re: Sorting Issue

Hello list. I am trying to do something that I know has been done before.

I have a list of promotions that I am getting from a database, and listing them by a field called Order. These promotions also have a unique ID with them.

I output them to a table and, to the right of each promotion title there is an up/down arrow so that the user can move them around. I know how to move them around in the browser, but I want to actually update the order in the database. The problem that I am having is making sure that I only change the order of the promotion just one above or below it, as well as the one I am moving. I am passing in the promotion ID and the Order number of the promotion that I want to move. So, how do I query for the record immediately above or below the one that I am moving? Does this make sense?

Thanks in advance,

Bruce

------------------------------------------------------------------------- This email server is running an evaluation copy of the MailShield anti- spam software. Please contact your email administrator if you have any questions about this message. MailShield product info: www.mailshield.com

Reply via email to