With the public release of ColdFusion 10 Beta yesterday, I thought I’d play around a bit with some of the new capabilities. One of the features added in this release is the ability to group in query loops using <cfloop>.

As expected, this is pretty straightforward, and has the same capabilities as the <cfoutput> corollary. Here’s a quick example:

<cfquery name="qproducts" datasource="somedatasource">
     select *
     from   products
     order by category,subcategory,product

     <cfloop query="qproducts" group="category">
          <cfloop group="subcategory" groupcasesensitive="true" >
                    #product#<br />

Pretty simple, but something which I know a lot of people have wanted for quite a while. Well, now you have it!

Share this: