I'd, first of all, select all the data I needed in one chunk. Nice,
locally cached dataset, in RAM, speedy delivery.

What happens from there is different based on your first query... is
it ordered by your group-by value?

If not, I'd do this:

Run a query-of-queries to do a distinct select against the column I
wanted to loop by.

Then, I'd loop over that query using CFLOOP and for every iteration,
I'd run a QofQ to select my data from the first query and loop that
for output.

I know, I know... performance, performance! Yeah, whatever.

It's squeaky clean, readable, sensible code. The first query is
locally cached and the subsequent queries could be written with
CFQUERYPARAM with should enhance performance.

If it is... I'd do what Mr. Dawson recommends... just loop over your
query and use a cfif to detect whether the currentrow.column value is
the same as your groupValue variable. If it's different, output the
groupby value, update the variable, and keep looping. If it's the
same, skip the group-by value and only output the data.

The real question is WHY you wouldn't want to use the cfoutput
groupby="" parameter... that's what it's there for.

Laterz!

J



On Tue, 22 Mar 2005 09:53:36 -0500, Pete Ruckelshaus
<[EMAIL PROTECTED]> wrote:
> Is there any way to do grouped query output using cfloop?  Reason is
> that I use a switch/case statement for my page, and wrap the entire
> thing in a cfoutput tag to make my code more readable.  I would like
> to do something like:
> 
> <cfoutput query="foo" group="groupcolumn">
> <h1>#groupcolumndata#</h1>
> <cfoutput>
> #blah#
> </cfoutput>
> </cfoutput>
> 
> But I would like to do it with cfloop or some other technique.  Is
> this possible?
> 
> Thanks
> 
> Pete
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:199732
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to