Question : cake php 2.x joins
Answered by : worrisome-wombat-evvkzp27vsq8
$this->Message->find('all', array( 'joins' => array( array( 'table' => 'users', 'alias' => 'UserJoin', 'type' => 'INNER', 'conditions' => array( 'UserJoin.id = Message.from' ) ) ), 'conditions' => array( 'Message.to' => 4 ), 'fields' => array('UserJoin.*', 'Message.*'), 'order' => 'Message.datetime DESC'
));
Source : https://stackoverflow.com/questions/5079908/cakephp-find-method-with-join | Last Update : Tue, 17 Aug 21