每天的唯一行数
我需要获取一天内登录我的网站的用户电子邮件地址列表。
该列表可能包含重复的电子邮件地址,但每天不得超过一个。
我需要获取一周的数据。
我有一个表,其中包含每次成功登录的记录,如下所示。
[ID], [LOGIN_EMAIL], [LOGIN_TIME]
以下查询获取本周的整个数据集,但我需要每天将其过滤到一个电子邮件地址并获取本周的整个列表?
SELECT LOGIN_EMAIL
FROM USER_LOGINS
WHERE LOGIN_TIME IS BETWEEN @STARTDATE AND @ENDDATE
I need to get a list of users email addresses that logged into my website over the course of a day.
The list may contain duplicate email addresses but not more than one per day.
I need to obtain this data for a week.
I have a table that contains records for each successful login as follows..
[ID], [LOGIN_EMAIL], [LOGIN_TIME]
The following query gets me the whole data set for the week but I need to filter it to one email address per day and get the entire list for the week?
SELECT LOGIN_EMAIL
FROM USER_LOGINS
WHERE LOGIN_TIME IS BETWEEN @STARTDATE AND @ENDDATE
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用
按天([LOGIN_TIME])、[LOGIN_EMAIL]分组
Use
group by Day([LOGIN_TIME]), [LOGIN_EMAIL]
您可能需要将 LOGIN_TIME 更改为日格式
you may need to chnge LOGIN_TIME to Day format