This idea may seem complicated, but it should work. Put the ORDER BY in the
SQL. Create an empty array. Do your cfoutput with the 'group' attribute. Use
cfsavecontent to put each Group's output into a variable in the array. Then
you can use some kind of randomizer to grab the output from the array. This
would have to be a randomizer that doesn't allow repeating (forget the
technical term for that).

Good luck.

On 4/11/06, Les Mizzell <[EMAIL PROTECTED]> wrote:
>
> Is there a way to group output in a query and keep the groups together,
> but with no order specified anywhere?
>
> <cfquery>
> Select myGROUP, mySubGROUP from myTABLE
> <!---(NO ORDER BY)--->
> </cfquery
>
> I need output like:
>
> 1. myGROUP
>     a. mySUBGOUP 1
>     b. mySUBGOUP 2
>
> 2. myGROUP 2
>     a. mySUBGOUP 1
>     b. mySUBGOUP 2
>
> If you just do the below, it doesn't keep the groups together since
> they're not together in the database...
>
> <cfoutput group="myGROUP">
> 1. myGROUP
>     a. mySUBGOUP 1
>     b. mySUBGOUP 2
> </cfoutput>
>
> Outputs (depending on what's in the database)
>
> 1. myGROUP
>     a. mySUBGOUP 1
>
> 2. myGROUP 2
>     a. mySUBGOUP 1
>     b. mySUBGOUP 2
>
> 1. myGROUP
>     b. mySUBGOUP 2
>
>
> If I add a ORDER to the query, it obviously works - but, the client
> doesn't WANT them in any order. He just wants the groups together.
>
> I say you can't have it both ways. You have to have a sort order to keep
> the groups together.  Or is there a weird work around for this?
>
>
> Yea - stupid I know, but clients want what they want...
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237456
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