我正在尝试获取提交的总数,我想要 2 个结果,1 个具有特定状态的提交和 1 个具有所有状态的提交:
SELECT submissions.campid,
COUNT(submissions.id) AS subsCountTotal,
(SELECT COUNT(submissions.id)
FROM submissions,campaings
WHERE submissions.campid = campaings.id
AND campaings.status = 1
and submissions.time >= campaings.startdate
and submissions.status = 10
GROUP BY submissions.campid) AS subsCountngood
FROM submissions, campaings
WHERE submissions.campid = campaings.id
AND campaings.status = 1
and CASE
WHEN campaings.enddate = '0000-00-00' THEN submissions.time >= campaings.startdate
ELSE submissions.time <= campaings.enddate
END
GROUP BY submissions.campid `
任何帮助将不胜感激:) 谢谢。