Hi,
I am trying to return calculated data from MySQL in a find. I am not
sure if this kind of thing is supposed to work at all. I may have to
resort to qustom queries.
Here is my little find statement:
$this->Post->find('all', array(
'fields'=>array(
'*',
'DATE(Post.created) AS post_date'
)
));
As you can see this first attempt is to just get the datetime from
created truncated to the date only. My plans are to be able to use
several different functions when the need arises. I am not sure what I
will gain from this but lopping the resulting array in php is usually
pretty slow compared to letting MySQL do some types of calculations.
The results are returned but they end un in their own model called 0.
I have also tried to rename "AS post_date" to "AS 'Post.post_date' "
but this data still ends up as its own model and the field gets the
full name including Post.
Is this not at all supported by CakePHP or am I just doing something
wrong?
/Martin
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---