Skip to content

Instantly share code, notes, and snippets.

@pulse00
Created March 8, 2010 13:49
Show Gist options
  • Save pulse00/325172 to your computer and use it in GitHub Desktop.
Save pulse00/325172 to your computer and use it in GitHub Desktop.
SELECT User.name , Document.id from users User
LEFT JOIN documents as Document ON (Document.user_id = User.id)
WHERE Document.status = 'SOME_STATUS'
$docs = $this->User->find('all', array(
'conditions' => array('Document.status' => 'SOME_STATUS'),
'joins' => array(
array (
'table' => 'documents',
'alias' => 'Document',
'type' => 'left',
'foreignKey' => false,
'conditions' => array('Document.user_id = User.id')
)
),
'contain' => array('Document')
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment