Showing posts with label join query in Yii2. Show all posts
Showing posts with label join query in Yii2. Show all posts

Wednesday, March 28, 2018

Yii2 Join Query

Yii2 provides many types of join:

  • Join()
  • leftJoin()
  • rightJoin()
  • joinWith()
  • innerJoinWith()
In below example we are using Join() method.

Yii2 Join Query


$query = (new Query())->from('user');
$query->select('user.id , user_profile.first_name , user_profile.last_name');
$result = $query->join('left join', 'user_profile', 'user_profile.user_id = user.id')->all();

Recent Update

yii2 session handling

use yii\web\Session; $session = Yii::$app->session; // start session $session->open(); // close session $session->close(); ...

Most Search