CREATE TRIGGER double_insert ON t1
AFTER INSERT AS
BEGIN
DECLARE @val real
SELECT @val = (SELECT val FROM inserted)
if @val >2
INSERT INTO t2 (val)
VALUES(3)
else
INSERT INTO t2 (val)
VALUES(1)
END
SELECT `data_nav_city`.* FROM `data_nav_city` INNER JOIN `data_nav_country` ON data_nav_city.country=data_nav_country.country WHERE `data_nav_city`.`id`=16
SELECT * FROM `data_nav_city` INNER JOIN `data_nav_country` ON data_nav_city.country=data_nav_country.country WHERE `data_nav_city`.`id`=16
$model=$model->select('*')->innerJoin('data_nav_country', 'data_nav_city.country=data_nav_country.country')->andWhere(['data_nav_city.id' => 16])->one();
var_dump($model->getAttributes());
$model=$model->select('*')->innerJoin('data_nav_country', 'data_nav_city.country=data_nav_country.country')->andWhere(['data_nav_city.id' => 16])->createCommand()->query();
var_dump($model->readAll());
$model=$model->innerJoin('data_nav_country', 'data_nav_city.country=data_nav_country.country')->andWhere(['data_nav_city.id' => '16'])->one();
var_dump($model->getAttributes());
$model=$model->innerJoin('data_nav_country', 'data_nav_city.country=data_nav_country.country')->andWhere(['data_nav_city.id' => '16'])->createCommand();
print_r($model);
[:qp0] => Array ( [0] => 16 [1] => 2 )
$model=$model->innerJoin('data_nav_country', 'data_nav_city.country=data_nav_country.country')->andWhere(['data_nav_city.id' => '16'])->all()
print_r($model);
У заказчика большой проект, переписывать не хочет - нет на то времени.
На Yii1 совсем нет решения, чтобы просто добавить в выборку поле с JOINa?..