MySQL 计数(不同(电子邮件)和按日期分组(条目日期)
在获取唯一记录总数和按日期分组方面遇到了一些麻烦。最终结果是我每天都会收到总计,但它没有使用基于不同功能的唯一电子邮件。这是我的查询...
SELECT count(distinct(emailaddress)), DATE(EntryDate)
FROM tblentries
group by DATE(EntryDate)
ORDER BY DATE(EntryDate) desc
结果最终没有对每天的计数进行重复数据删除。想法?
谢谢!
Having a bit of trouble with getting total unique records and grouping by date. The end result is I am getting totals per day but it is not using unique emails based on the distinct function. Here is my query...
SELECT count(distinct(emailaddress)), DATE(EntryDate)
FROM tblentries
group by DATE(EntryDate)
ORDER BY DATE(EntryDate) desc
The results end up not de-duping the count for each day. Thoughts?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据对话,我相信您正在寻找的是每天不同的从未见过的电子邮件地址的数量:
这是我的想法,所以它可能不正确,而且会很慢,但是我认为这是正确的方向。顺便说一句,如果您计划定期运行此操作,则电子邮件地址索引将是一个好主意。
让我知道这是否有效。
Based on the conversation, I believe what you are looking for is the number of distinct never-before-seen email addresses per day:
This is off the top of my head, so it may not be right, and it will be slow, but I think this is in the right direction. On a side note, if you plan on running this regularly, an index on emailaddress would be a good idea.
Let me know if this works.