nope, didn't do it
thanks Jochem

-paul



-----Original Message-----
From: Jochem van Dieten [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 8:25 PM
To: CF-Talk
Subject: Re: ORDER BY question


Randell B Adkins wrote:
> Create a new field called Sequence or something.
> Based on the data and the two elements you displayed
> there is no way without Hard-Coding it.

Actually, there is if your database can do a little bit of maths and 
subqueries in the ORDER BY clause. But it is a bit tricky and get's out 
of hand when the number of elements in the list get's too long because 
you need to develop a power series to sort on :)

ORDER BY ( 0
<cfloop from="1" to="#ListLen(titleIDs)#" index="i">
+ (SELECT MAX(TitleID FROM tblJobTitle))^(ListLen(titleIDs) - i) * 
Round(Abs(tblJobTitle.TitleID - i)/(Abs(tblJobTitle.TitleID - i) + 1))
</cfloop> ) DESC

I doubt this will be usefull IRL, but it should work once you sort out 
the typo's you will inevitably get. Conversion to a stored procedure 
will help as well, you will be able to get the SELECT MAX(TitleID FROM 
tblJobTitle) out of the loop.

Jochem


______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to