siteadvice
11/15/2022, 9:01 PM<cfset maxpriceQuery = QueryNew("id,maxprice","integer,integer")>
<cfset QueryAddRow(maxpriceQuery, #get.recordcount#)>
<cfset intMaxPriceLoop = 1>
<cfloop query="get">
<cfset QuerySetCell(maxpriceQuery, "id", #id#, intMaxPriceLoop)>
<cfset QuerySetCell(maxpriceQuery, "maxprice", #maxprice#, intMaxPriceLoop)>
<cfset intMaxPriceLoop = intMaxPriceLoop + 1>
</cfloop>
Then I want to be able to select from that query, something like this...
select top 2 id from maxpriceQuery where maxprice <= #getprice.price#
But I don't know how.
Can someone help?
I thought maybe I could use this...
<cfquery name="getmydata" datasource="maxpriceQuery">
...but that's evidently wrong because maxpriceQuery is not a valid datasource.
I'm sure I did this once years ago but I'll be darned if I can figure out how. :-)Mark Takata (Adobe)
11/15/2022, 9:06 PMMark Takata (Adobe)
11/15/2022, 9:06 PMMark Takata (Adobe)
11/15/2022, 9:07 PMMark Takata (Adobe)
11/15/2022, 9:07 PMsiteadvice
11/15/2022, 9:21 PMMark Takata (Adobe)
11/15/2022, 9:37 PMaliaspooryorik
maxpriceQuery
query though - that's a long way around to get the top 2 items. I would think a queryFilter
on the original get
query would be a much cleaner way to handle that (assuming maxpriceQuery
isn't used anywhere else)aliaspooryorik