Get last 7 days records from table in zend

2019-08-20 09:47发布

Hi guys i am trying to get last 7 days closed tickets from table Here is the query i have wrote

'closed' => new Zend_Db_Expr('SUM(IF(rt.assignee_id IS NOT NULL,IF(rt.status_id = 24,1,0),0))')

can any one help me how can i add my condition inside IF?

Thanks in advance.

1条回答
Evening l夕情丶
2楼-- · 2019-08-20 10:19

'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))')

not 100% sure about the CURDATE() - INTERVAL 7 DAY, but i think you will understand it.

查看更多
登录 后发表回答