嗨,伙计们,我正试图从表中得到过去7天关闭的机票这里是我写的查询
'closed' => new Zend_Db_Expr('SUM(IF(rt.assignee_id IS NOT NULL,IF(rt.status_id = 24,1,0),0))')
有谁能帮我把我的情况加进去吗?提前谢谢。
t40tm48m1#
'closed' => new Zend_Db_Expr('SUM(IF(rt.assignee_id IS NOT NULL, IF(rt.status_id = 24, IF(created >= CURDATE() - INTERVAL 7 DAY, 1,0),0),0))') 不是100%确定 CURDATE() - INTERVAL 7 DAY ,但我想你会理解的。
'closed' => new Zend_Db_Expr('SUM(IF(rt.assignee_id IS NOT NULL, IF(rt.status_id = 24, IF(created >= CURDATE() - INTERVAL 7 DAY, 1,0),0),0))')
CURDATE() - INTERVAL 7 DAY
1条答案
按热度按时间t40tm48m1#
'closed' => new Zend_Db_Expr('SUM(IF(rt.assignee_id IS NOT NULL, IF(rt.status_id = 24, IF(created >= CURDATE() - INTERVAL 7 DAY, 1,0),0),0))')
不是100%确定CURDATE() - INTERVAL 7 DAY
,但我想你会理解的。