How to create a query is not null in yii2?

Hello! Create the query :
$dr = TableName::find()->joinWith('idTb')
 ->where(['is not', 'Date_end', null])

The bottom line is, you need to select records where the field 'Date_end' is not null.
[0] => [[..., 'Date_end' => '2014'], [...,'Date_end'=>]]
[1] => [[..., 'Date_end' => '2015']]
The query selects 0 and 1 have only 1
July 8th 19 at 16:05
1 answer
July 8th 19 at 16:07
$query = new Query; 
$query->select('ID, City,State,StudentName')
 ->where(['IsActive' => 1])
 ->andWhere(['not', ['City' => null]])
 ->andWhere(['not', ['State' => null]])
 ->orderBy(['rand()' => SORT_DESC])

P. S. 2-th result in the issuance of Google for "yii2 not null"
the method I used in the beginning (forgot to mention), it did not work immediately, then solved the problem like this : where(['is not', 'Date_end', null]), previously worked, but for some reason stopped in time (he is in shock as it happened), now think of how else it can be arranged - watson_Torphy commented on July 8th 19 at 16:10
: need to organize - to write the query "handles" and compare with what the Query is created - Helois commented on July 8th 19 at 16:13

Find more questions by tags YiiAugmented reality