2011-10-11 51 views
0

我需要的是在建立這樣的查詢與Zend_Db的的:Zend_Db的WHERE NOT

SELECT * FROM mytable 
WHERE NOT (field1 = 0.00 AND field2 = 0.00 AND field3 = 0.00); 

我怎樣才能做到這一點與Zend_Db的,也是MySQL的方法正確嗎? (如果所有三個字段均爲0.00,則忽略它)。

感謝您的回覆!

回答

0

我想這應該這樣做:

$db->select() 
    ->from('mytable') 
    ->where('field1 != 0.00') 
    ->where('field2 != 0.00') 
    ->where('field3 != 0.00'); 
0

我覺得應該是

$query = $this->select() 
       ->from('mytable') 
       ->where('field1 <> ? AND field2 <> ? AND field3 <> ?', 0, 2) /*2 is Zend_Db::FLOAT_TYPE*/