AFAIK you can't use variable after LIMIT so u can't get your result set in one call. I would make model function which at first will retrieve visiblecomments number and then use it as value for 'limit' key in options array for find function.
On 9. Feb, 03:18 h., freespac <[EMAIL PROTECTED]> wrote: > I have to tables, "stories" and "comments". They have a relationship > > story has many comments. > comment belongs to story. > > In stories, I have a field named "visiblecomments" (yes it's long ;) > > I want to return only a number of comments (that is defined in > "visiblecomments") in every story. > > Example: > > Story 1: > > id: 1 > title: this is first story. > visiblecomments: 2 > has 4 comments. > > Story 2: > id: 2 > title: this is second story > visiblecomments: 1 > has 5 comments. > > I want it to return the following: > > 2 comments from the first story and 1 comment from the second story. > > hope that made any sense.. > > -thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
