ColdFusion Query of Queries Order By Case Sensitivity Fun

Have you ever tried using ORDER BY in a query of queries in ColdFusion, well come to find out its case sensitive, and I need it to be case insensitive.I have a query of queries in ColdFusion. In Windows my original query sorted it self out just fine, because it was listing the underlying File system items which are case insenstive. When I deployed the code on Linux of course the original query sorts differently. The code actually does another query on the first query to add some other fields. But when I did a ORDER BY Name on this query of queries it was Case Sensitive, and thus a capital “Z” came before a lowercase “a”. You can not use the UPPER or LOWER query functions on the ORDER BY clause but you can use them when defining a field.

This led me to the solution below.

PLAIN TEXT

XML:

  1. SELECT  Name,

  2. UPPER( Name ) as DName

  3. FROM myList

  4. WHERE type = ‘Dir’

  5. ORDER BY DName

Is there a built in way in ColdFusion to do this with out create a new column on the query?

Leave a Reply