I want to use a yii2
query in which i want to check a not equal to condition.
I tried like this but it didn't give the desired results. how do i do it?
$details = MovieShows::find()->where(['movie_id'=>$id])
->andWhere(['location_id'=>$loc_id])
->andWhere(['cancel_date'=>!$date])->all();
In addiction to the @tony answer, for those who need to encapsulate a subquery here there's a quick example:
You can just use the below pasted code:
Maybe it help you for whom need to use subquery .
You can also try this:
for Greater than
for less than
More check here
Maybe this one help...:)
In this case you need to use operator format:
[operator, operand1, operand2, ...]
. So your code should look like this:More about using where method and operator format