cruim
cruim

Reputation: 319

negation in query condition yii2

How get list without some city in query condition. Something like that

joinWith(['address' => function($query){
        $query->orWhere(['order_delivery_address_city' => 'New York']);
        $query->orWhere([ 'order_delivery_address_city' => 'London']);

How set negation for this like != New York?

Upvotes: 0

Views: 680

Answers (1)

Ripper
Ripper

Reputation: 1162

$query->orWhere(['NOT', ['order_delivery_address_city' => 'New York']]);

It is operator form of condition, you might Google more about it,

Instead of 'NOT' you can use operators like < > != = Etc...

Upvotes: 2

Related Questions