2017-09-03 94 views
0

我想找到所有的卡车与某些状态与比较值Yii2查询

所以这是方法我做

$trucks::TblTrucks::find() 
     ->where(["!=" "status", 13]) 
      ->andWhere(["!=" "status", 14]) 
      ->andWhere(["!=" "status", 17]) 
      ->andWhere(["!=" "status", 2]) 

上述工作,但看起来abiit搞砸了,所以我想重写它到

$trucks::TblTrucks::find() 
     ->where(["!=" "status", [13,14, 17,2]) 

但上述失败。 我哪里错了?或者我如何重写它,包括数组中的所有状态值。

+0

失败怎么办?你有错误吗?我看到丢失的逗号,这是吗? – Fotis

回答