|
|
You could try the same pinciple/idea of what I posted in thread
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid=1&catid=7
Copied/Pasted from that thread:
You could read thru the first query and add the contents to a temp query
assigning a sort by field and then read thru the second query and add it to the
same temp query with a sort by field. Then do a query of that temp query.
<cfset TempQuery = QueryNew( "Id, listingName, SortOrder, ..." )>
<cfquery datasource="db" name="all_listings" >
select *
from tbl_listings
where advert_type = 0 or advert_type = 1
</cfquery>
<cfoutput query="all_listings">
<cfset foobar = QueryAddRow(TempQuery, 1)>
<cfset foobar = QuerySetCell(TempQuery, "Id", #Id#)>
<cfset foobar = QuerySetCell(TempQuery, "listingName", #ListingName#)>
<cfif advert_type IS 1>
<cfset foobar = QuerySetCell(TempQuery, "SortOrder", 1)>
<cfelse>
<cfset foobar = QuerySetCell(TempQuery, "SortOrder", 2)>
</cfif>
</cfoutput>
<cfquery datasource="db" name="premium_listing_only" >
select *
from tbl_listings
where advert_type = 1
</cfquery>
<cfoutput query="premium_listing_only">
<cfset foobar = QueryAddRow(TempQuery, 1)>
<cfset foobar = QuerySetCell(TempQuery, "Id", #Id#)>
<cfset foobar = QuerySetCell(TempQuery, "listingName", #ListingName#)>
<cfset foobar = QuerySetCell(TempQuery, "SortOrder", 3)>
</cfoutput>
<cfquery name="GetListings" dbtype="query">
SELECT
FROM TempQuery
ORDER BY SortOrder
</cfquery>
|
|