2012-07-05 41 views
0

可能有人請告訴我一個Zend DB查詢,以表示最後一行(and (xxx or xxx)Zend的DB - 在哪裏,或查詢

... 
where 
    id = 1241487470 
and (contract=0 or is_work IS NOT NULL) 
... 

我被困在這個正確的語法:

->where('id = ?', 1241487470) 
->where(...) 

回答

3

這似乎合乎邏輯和工作。所以,恭喜

->where('id = ?', 1241487470) 
->where('contract= ? or is_work IS NOT NULL) 
+0

這是處理這種情況的正確方法。但是你的意思是Zend DB而不是Form? –

+0

是的,我確實:)一定是漫長的一天。我糾正了它。乾杯。 – Jarrod

2

這似乎也工作和維護Zend的分貝擒

->where('id = ?', 1241487470); 
->where('(contract = ?', 0); 
->orWhere('is_work IS NOT NULL)');