Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

How to order a query by a column added using QueryAddColumn()?

$
0
0

I have a query ("GetTotals"). I'm adding a column there from the other query ("GetTheList") using the standard code:

 

          <CFSET myArray = ArrayNew(1)>

 

            <cfloop query="GetTheList">

                <CFSET TotalJobs = GetTheList.Total>

 

                <CFSET x = ArrayAppend(myArray,TotalJobs)>

            </cfloop>

 

            <CFSET x = QueryAddColumn(GetTotals, "Totals", "VarChar", myArray)>

 

<CFOUTPUT QUERY="GetTotals"> shows everything the way I need.

Except for one problem: How I order the output by that added column?

 

Simple re-order (below) works for one column only but not for all of them.

    <cfquery name="ResortQuery" dbtype="query">

                  SELECT *

                  FROM GetTotals

                  ORDER BY  Totals DESC

                </cfquery>


All ideas are appreciated!


Viewing all articles
Browse latest Browse all 5794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>