Tutorialsplane

Yii join query where condition


Yii join query where condition Syntax And Example : Yii join is used to get data collectively from one or more than one table.


Yii join query where condition Syntax

$customers = Users::find()
    ->select('users.*')
    ->leftJoin('order', '`order`.`user_id` = `user`.`id`')
    ->where(['order.status' => '1'])
    ->with('orders')
    ->all();

Which will result the row where id is equal to $id. The above query will produce the following result.

//Select id,name, email from users where id = “5”

where $id = 5;

Yii Database Refrence

Yii General