Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

cakephp 2.x join

$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 by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #cakephp #join
ADD COMMENT
Topic
Name
2+8 =