CakePHP在一个查询中进行多次计数

CakePHP在一个查询中进行多次计数,cakephp,cakephp-3.0,Cakephp,Cakephp 3.0,我想在CakePHP3中从一个名为Posts的表中获得不同条件下的多个总计 这可能吗 已发送的邮件计数,其中已发送的邮件=0 已发送的邮件计数,其中已发送的邮件=1 计算rsvp,其中rsvp=3 SELECT count(Case when post_sent=0 then 1 else 0 end) as post_not_sent, count(Case when post_sent=1 then 1 else 0 end) as post_sent, cou

我想在CakePHP3中从一个名为Posts的表中获得不同条件下的多个总计

这可能吗

已发送的邮件计数,其中已发送的邮件=0

已发送的邮件计数,其中已发送的邮件=1

计算rsvp,其中rsvp=3

SELECT count(Case when post_sent=0 then 1 else 0 end) as post_not_sent, 
       count(Case when post_sent=1 then 1 else 0 end) as post_sent,
       count(Case when rsvp=3 then 1 else 0 end) as rsvp_sent
FROM content_form

你试过在文档中搜索案例陈述吗?非常感谢,我没有看到这个部分。正是我需要的