Yii2 innerJoin()

前端 未结 4 747
天命终不由人
天命终不由人 2021-01-12 16:06

I want to implement a sql query in the following way:

INNER JOIN
`Product_has_ProductFeature` t ON `Product`.`id` = t.`productId` AND t.`productFeatureValueI         


        
4条回答
  •  粉色の甜心
    2021-01-12 16:35

    $query = new \yii\db\Query();
    $query->from(['u' => 'usr_user'])
        ->select(['u.id','p.first_name','p.last_name'])
        ->innerJoin(['i' => 'pdl_inspector'],'`u`.`id` = `inspector_id`')
        ->innerJoin(['p'=>'usr_profile'],'`p`.`user_id` = `u`.`id`')
        ->all();
    

提交回复
热议问题