I have been using a modified DBO for MySQL which does the translation "automatically" if you write "... AS Modelname__fieldname". I am not really sure about the downside to using it but it has not given me any problems with that project that I am aware of.
It is called dbo_mysql_ex and wirrten by Grigri. http://i-love-cake.pastebin.com/f78d0639a (I only kept the resultSet method) The orignlal thread: http://groups.google.com/group/cake-php/browse_thread/thread/2fa2cd69422dfcf/ And @Grigri... thank you so much. These few lines of code still work wonders every day :) /Matin On Feb 4, 3:39 am, brian <[email protected]> wrote: > I posted a similar query here last week. I was hoping to use Set class > to do the same. I guess grigri wasn't around ;-) > > Teknoid suggested this method: > > http://teknoid.wordpress.com/2008/09/29/dealing-with-calculated-field... > > On Tue, Feb 3, 2009 at 8:41 PM, Miles J <[email protected]> wrote: > > > Ok I got it working, but its outside of the array I want. Anyway to > > get it in there? > > > [TeamsUser] => Array > > ( > > [id] => 1 > > [team_id] => 1 > > [user_id] => 2 > > [role] => leader > > [status] => approved > > [joinDate] => 1231636154 > > ) > > > [0] => Array > > ( > > [totalMembers] => 6 > > ) > > > Heres my query: > > > 'fields' => array('TeamsUser.*', "(SELECT COUNT(id) FROM teams_users > > AS TeamsUser WHERE TeamsUser.team_id = Team.id AND TeamsUser.status = > > 'approved') AS totalMembers") > > > I tried doing AS TeamsUser.totalMembers and it didnt work. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
