如何编辑以下查询以返回
,而不是返回5行date --- rows found
date --- rows found
date --- rows found
这是查询
SElECT * FROM emails WHERE maildate >= DATE_ADD(CURDATE(), INTERVAL -3 DAY) and company_id = 1 order by maildate desc
答案 0 :(得分:0)
maildate
和COUNT(*)
上的小组应该有效:
SELECT maildate, COUNT(*) as TotalEmails --change alias as desired
FROM emails
WHERE maildate >= DATE_ADD(CURDATE(), INTERVAL -3 DAY)
AND company_id = 1
GROUP BY date(maildate) --Remove timestamp for grouping
ORDER BY maildate desc
虽然目前还不清楚你想要归还什么。样本数据和预期输出会有所帮助。