On Jan 15, 12:29 pm, quentin <[email protected]> wrote: > Hi > > I have some strange mysql error when I try to select Max(field1) and > field2. if I select only Max(field1) ( SELECT Max(Alias.field1) as field1 > From table ) it works. > Ok this error probably comes from the mysql version ( ovh server : mysql > client Api Version 5.0.32 ) because everything works with all my other > configuration. > > *This error is easy to fix* : I add 'group'=>array('Alias.primaryKey') in > the options of the find function. > but the TreeBehavior for example frequently ask for the Max(Tree.rght) with
The key for you to understand your question is to realize it's 100% sql. select max(foo) from bar is the same as select foo from bar order by foo DESC LIMIT 1 The tree behavior does not mix max() with other fields - if you are doing that it's something related to how you've configured/setup $recursive and other associations in your model. > other fields (during Insertion for example) and doesn't group rows. > > So when I create Menu (using Tree behavior) I have a mysql error. The tree behavior is not required to build a menu, I would say it's inappropriate to use the tree behavior for _just_ a menu. AD -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
