Код: Выделить всё
$query = Order::find()
->select("IF(operator_real_date IS NULL, 0, (IF(TIMEDIFF(operator_real_date, operator_real_date) > 0, 1, 2))) as `status_time_operator`")
->where(['id' => $this->id])
->asArray();
$information_about_deadline = $query->one();
Код: Выделить всё
SELECT IF(operator_real_date IS AS `NULL`, `0`, `1`, `operator_real_date) >` AS `0`, 2))) as `status_time_operator` FROM `orders` WHERE `id`=6'