gpt4 book ai didi

php - Zend_Db_Table 子查询

转载 作者:可可西里 更新时间:2023-11-01 13:34:38 25 4
gpt4 key购买 nike

我有一些 SQL 想与 ZendFW 一起使用,但我无法让它工作,这让我抓狂。我通过此查询得到了正确的结果:

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)

帮助将不胜感激。干杯:)

最佳答案

Goran 的回答是最好的答案。但是如果你想要一个 zend_db_table 风格的查询,这将是一个替代方案:

$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"));

关于php - Zend_Db_Table 子查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1718888/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com