2017-09-03 95 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

回答