Re: Help with a moderately complex query

2006-12-16 Thread Jacob Buys
I found this easy solution to calculated fields somewhere in the group: http://groups-beta.google.com/group/cake-php/msg/c74f50974ffe2d62?hl=en&; It uses SQL views, which makes things a lot easier (at least to me :-), as you don't have to fiddle with the results array... Hope it helps, Jacob

Re: Help with a moderately complex query

2006-12-16 Thread AD7six
Hi Chris, Why are you not able to change that loop, is the loop itself some how legacy? It's not clear to me where/how the minimum and maxium members values need to be determined - where does that come from, is that in the stat table? Anyway here are a few different permutations depending on wha

Re: Help with a moderately complex query

2006-12-16 Thread [EMAIL PROTECTED]
Hi Chris There is a method model->afterFind() that can be useful in some situations, but rather than fight too hard (which tends to make the code/sql less readable), I let cake return what it wants with the find*() and then reformat the array in the model before returning to the controller. This

Re: Help with a moderately complex query

2006-12-15 Thread the_woodsman
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/aa19397789

Help with a moderately complex query

2006-12-15 Thread Chris Hartjes
After handing out so much help (some good, some bad) I need some help getting a query to work with the models. Currently, I have the following two queries using the model: $start_results = $this->Stat->findAll("Site.category = {$category} AND Stat.s_date = '{$start_date}'"); $finish_results = $t