首页 > 代码库 > yii2:多表查询

yii2:多表查询

啥都不说了,上代码:

$list = static::find()
                    ->leftJoin(‘book‘,
                        ‘book.RID = prices.RID‘)->select(‘prices.*,book.WCONTENT,book.WIMGURL,book.WURL‘)
                    ->andFilterWhere([‘prices.WMODEL‘=> $where_condition[‘WMODEL‘]])
                    ->andFilterWhere([‘prices.WTYPE‘=> $where_condition[‘WTYPE‘]])
                    ->offset($params[‘offset‘])
                    ->orderBy([‘prices.WCREATETIME‘ => SORT_DESC])->limit($params[‘limit‘])->asArray()->all();

  

yii2:多表查询