Reputation: 10704
In Yii2, I need compare two column that in relation.
For example be like:
$query->andWhere(['product.form' => 'subcategory.form']);
build this query:
WHERE `product`.`form`='subcategory.form'
But I need be like this query:
WHERE `product`.`form`=`subcategory`.`form`
Upvotes: 1
Views: 443
Reputation: 10704
I find the solution, It's easy with this code:
$query->andWhere('`product`.`form`=`subcategory`.`form`');
Upvotes: 1