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();

3 comments:


  1. It is nice post and I found some interesting information on this blog, keep it up. Thanks for sharing. . .
    Hire Yii Developers in India

    ReplyDelete
  2. Thanks for sharing this short informative note on Yii2 Join Query with an example. if you have any requirement to Hire Yii Developers for your project. Please visit us.

    ReplyDelete

Recent Update

yii2 session handling

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

Most Search