You need to set the sortORD for the remaining values to greater than the last important item for that query. If you had 3 item that were important, you would need to set the sortORD to 4 for the rest of the items, that would allow the secondary sort to actually sort.
> -----Original Message----- > From: Les Mizzell [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 19, 2007 12:44 PM > To: CF-Talk > Subject: cfquery "order by" question > > i have an adin form that allows a client to specify the sort > order of a returned collection of results. Easy enough, but > I've run into a slight snag... > > Here's the basic query... > > <cfquery name="sortCARDS"> > Select name, amount, date > FROM COLLECTIONS > WHERE collection_id = '#url.colID#' > ORDER BY sortORD ASC > <cfif IsDefined("getPAGE.sortMETH") AND #getPAGE.sortMETH# NEQ ""> > ,#getPAGE.sortMETH# > </cfif> > </cfquery> > > > #getPAGE.sortMETH# allows you to sort by name, amount, or > date - ascending or descending - if you define that. > > "sortORD" is a field in the table itself where you can > specify a specific order outside the "sortMETH" above by > putting in 1, 2, 3 .... > > OK, the problem: > 1. let's say there's 15 returned records 2. I've entered > "name asc" as my "sortMETH" > 3. I've got three specific records I want FIRST, outside the > alpha sort, so I enter 1, 2, 3 in the "sortORD" fields too. > > It will sort by "sortORD" like it's supposed to, but it > returns those LAST in the recordset after the alpha sort. > > If I don't define a "sortMETH" - it will place all records > with NO sortORD *first*, THEN the ones with sortORD defined. > > How do I get my numberic sort fields to take priority and > come up first without maybe having TWO queries defined and > two output blocks? > > TIA! > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295185 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4