SQL Order - matching results to a list
I have a list which I query, matchin the list on the camp_uid. The problem is that I want to display the results in the same order as the list was originally compiled, which is not in numeric order. One option is to set up a loop on the original list values, then use a query over query to obtain the results that are appropriate to that camp_uid, but there must be a better way? I search the ORDER command, there does not seem to be anything in place to make it keep the order of the supplied list in the IN statement.
Anybody have any better ideas than my query over query? I am a lilttle concerned over the the performance being forced to run multiple queries over data that I already have, even if they are in a Query over Query
<CFQUERY name="GetCamp" DATASOURCE="#datasource#">
SELECT camp_uid,camp_title,camp_text,camp_image_type
FROM campaigns
WHERE camp_uid IN (
<cfqueryparam value="#session.camp_list#" cfsqltype="CF_SQL_INTEGER" list="true">
)
</CFQUERY>
Thanks
Mark
