Have you thought about building it up as an associate array first then sort
based on the struct key?

Then convert it to a query later?



-----Original Message-----
From: Les Mizzell [mailto:[email protected]] 
Sent: Saturday, 15 May 2010 8:43 AM
To: cf-talk
Subject: Re: Is there a way to do an arbitrary sort order on a specific
cell?


Charlie Griefer wrote:
> case statement in the ORDER BY should work.
> 
> See http://www.devx.com/tips/Tip/17288

Checking my syntax, but doesn't seem to work for a query of queries..

Like:

<cfloop query="featureMENU">
  <cfset temp = QueryAddRow(hasMEDIA)>
  <cfset temp = QuerySetCell(hasMEDIA, "tHEAD", "#req.tHEAD#", #tCOUNT#)>
  <cfset temp = QuerySetCell(hasMEDIA, "sid", "#sid#", #tCOUNT#)>
</cfloop>


<cfquery dbtype="query" name="getAllMedia">
SELECT
    tHEAD,
    sid
FROM hasMEDIA
ORDER by ( Case thisHEAD
    WHEN 'Feature Article' THEN 1
    WHEN 'Quoatable' THEN 2
    WHEN 'On the Money' THEN 3
    WHEN 'In the News' THEN 4
    WHEN 'Innovation' THEN 5
    WHEN 'About Us' THEN 6
    WHEN 'Border Bound' THEN 7
    WHEN 'Quick Facts' THEN 8
    ELSE 100 END )
</cfquery>

ERROR: Query Of Queries syntax error.
Encountered "(. Incorrect ORDER BY column reference [(].
Only simple column reference, alias name, and integer column id are 
allowed.


__________ Information from ESET NOD32 Antivirus, version of virus signature
database 5115 (20100514) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333722
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to