Hi Chris, To my knowledge, use of SQL min(members), or any other SQL aggregate function, will only be stored in index [0] of the results array - I was looking for something similar in a post named 'Output format of findAll':
http://groups.google.com/group/cake-php/browse_thread/thread/aa19397789bd7425/bcca7c16d04cdbca?lnk=gst&q=findAll+nice+output&rnum=1#bcca7c16d04cdbca In fact, even when I went as far as aliasing the aggregate function to a field name in the model (i.e SUM(`Model`.quantity) as `quantity`), the result still goes in the 0 index, rather than the ModelName index. The only new idea I've had about this was to use the array format for passing SQL params to findAll, as Cake generally seems to understand these better. Apart from that, I don't think you've got a choice but to put the stuff from index [0] into the [ModelName] field yourself with an ugly and hard to maintain loop through the results set. If you do end up doing this, learn from my mistakes, and from CakeBaker's blog, and put it direct in the model rather than the Controller, as this makes it a bit more readable and keeps your controllers cleaner. This whole issue of using aggregate functions led me into some crazy array formats, which I went on a rant about in this post: "Passing data to the view in a nice way?" http://groups.google.com/group/cake-php/browse_thread/thread/ecdd0bcffcd6f5b6 I think I scared my fellow Bakers off with that! Sorry I can't be more help, please let me know if you find some nicer solutions! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
