Так что моя таблица < /p>
Код: Выделить всё
tbl_truck
id, name
tbl_checks
id
truck_id //foreign key from tbl_truck table id
< /code>
Итак, в моем запросе у меня есть < /p>
$query = TblTrucksModel::find()
->leftJoin('tbl_checks','tbl_trucks.id = tbl_checks.truck_id')
->where() //here add the condition
nb: tbltrucksmodel представляет tbl_trucks table
Подробнее здесь: https://stackoverflow.com/questions/494 ... e-not-null
Мобильная версия