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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resorting query results

Status
Not open for further replies.

siituser

Programmer
Sep 30, 2002
67
CA
Hi there,

In an attempt to optimize our app, I'm trying to reuse a number of queries. I've got a bunch that are similar except for the Order By statement. I'm thinking that if I just lose the Order By line of the query I can reuse it all over the place. I just need to sort it the way I want after it has run


What is the best way to sort query results after the query has run?
I thought about doing a query of queries but I'm not sure how efficient that is going to be.

Thanks
 
query of queries..

Code:
<cfquery datasource="dsn" name="myq">
  select id,fname,lname from people
  order by id
</cfquery>

<cfquery dbtype="query" name="myqfname">
  select * from myq
  order by fname
</cfquery>

<cfquery dbtype="query" name="myqlname">
  select * from myq
  order by lname
</cfquery>

<Cfoutput>myq: #valuelist(myq.id)#<br>
myqfname: #valuelist(myqfname.id)#<br>
myqlname: #valuelist(myqlname.id)#</cfoutput>

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top