@euromark, that works, but is it really safe? 

To best of my knowledge and experience with MySQL, using MAX (and other 
aggregate friends) with other fields in the same query does not necessarily 
ensure that other fields will correspond to the same row! Correct me if I'm 
wrong, but this is how I interpreted the MySQL documentation.

For instance SELECT id, MAX(price), product_type .... GROUP BY 
(product_type) is not a 100% way to get the ID of the record with the 
highest price. Which is odd to me, but I've been tackling this problem for 
ages now and this 
example<http://dev.mysql.com/doc/refman/5.0/en/example-maximum-row.html>made me 
question this approach.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to