Hi i,
I need to do the following query using the cakephp findCakePHP find method:
SELECT * FROM `messages` INNER JOIN users ON messages.from = users.id WHERE messages.to=4to = 4 ORDER BY messages.datetime DESC Basically I have:
messages table with a Message model
users table with User model
messagestable with aMessagemodeluserstable withUsermodel
and want to retrieve information from both tables in one query. The users.idusers.id field is the same as the messages.frommessages.from field, so thatsthat's what the join is on.
I am doing it in my messages controllerMessagesController so it would need to be something like:
$this->Message->find(); Thanks