Skip to content

Instantly share code, notes, and snippets.

@vicenterusso
Created August 19, 2013 14:29
Show Gist options
  • Save vicenterusso/6269755 to your computer and use it in GitHub Desktop.
Save vicenterusso/6269755 to your computer and use it in GitHub Desktop.
Yii join
$rows = Yii::app()->db->createCommand()
->select('j.*, p.orderno, p.category, o.bidno')
->from('jobs j')
->join('projects p','j.projid = p.projid')
->join('orders o', 'p.orderno = o.orderno')
->where('j.projid=:id', array(':id'=>$id))
->order('j.jobno,j.projid')
->queryRow();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment