yii2 mysql如何跨数据库联表查询?
我这样写好像不行啊
$query = (new Query())->from('vip as ccv');
$query->leftJoin(\Yii::$app->get('db').'user as u','ccv.phone = u.user_mobile_phone');
$query->leftJoin(\Yii::$app->get('db').'applet as uah','uah.user_id = u.user_id');
$query->leftJoin(\Yii::$app->get('db').'grade as cvg','uah.level = cvg.vip_id');
if (isset($condition['mobile']) && $condition['mobile'] != '') {
$query->andWhere(['=', 'mobile', $condition['mobile']]);
}
你先在数据库上写出来这种的sql试试就知道了
哦 这样啊 阿亮吃饭了没