Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Sorting problem

Status
Not open for further replies.

olmos

Technical User
Joined
Oct 25, 2000
Messages
135
Location
US

This is my query I want the column "total" which is in a CFLOOP query to sort in descending order..
I thought this would work but it is not being sorted. Is there a problem in
the query that I am missing..

Thanks in advance,
Olmos..

<CFQUERY name=&quot;exploit&quot; datasource=&quot;#PrimaryDataSource#&quot;>

SELECT distinct exploit_id, exploit_method

FROM exploit

</cfquery>

<CFLOOP query=&quot;exploit&quot;>

<CFQUERY name=&quot;get_count&quot; datasource=&quot;#PrimaryDataSource#&quot; >
SELECT count(id) &quot;total&quot;

FROM computer j, event e

Where j.id = e.event_id

AND e.date BETWEEN '#fiscal_year_start#' AND '#fiscal_year_end#'

AND j.exploit_id = '#exploit_id#'

ORDER BY &quot;total&quot; DESC

</CFQUERY>


... <td>#exploit_method#</td>


... <td>#get_exploit_count.total# <br>


</cfloop>

 
If you want your loop sorted, you will need to put the appropriate &quot;ORDER BY&quot; clause into the query that you are looping on, in this case, your &quot;exploit&quot; query, not in a query within the loop.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top