本文介紹了Zend_Db_Table 子查詢的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
我有一些 SQL 想與 ZendFW 一起使用,但我無法讓它工作,這讓我發(fā)瘋.我通過這個查詢得到了正確的結(jié)果:
I have a some SQL that I want to use with ZendFW, but I can't get it working and it's driving me crazy. I get the correct result with this query:
SELECT DISTINCT e.festival_id FROM entries AS e, mail_log as m
WHERE e.status = 1
AND e.festival_id
NOT IN (SELECT m.entry_id FROM entries AS e, mail_log as m WHERE m.entry_id = e.festival_id)
幫助將不勝感激.干杯:)
Help would be appreciated. Cheers :)
推薦答案
Goran 的答案是最好的答案.但是如果你想要一個 zend_db_table 樣式的查詢,這將是一個替代:
Goran's answer is the best answer. But if you want a zend_db_table style query, this would be an alternative:
$sql = $table->select()
->setIntegrityCheck(false)
->from('entries', new Zend_Db_Expr('DISTINCT festival'))
->where('status = ?', 1)
->where('festival_id NOT IN (?)',new Zend_Db_Expr("SELECT m.entry_id FROM entries AS e, mail_log as m WHERE m.entry_id = e.festival_id"));
這篇關(guān)于Zend_Db_Table 子查詢的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!