如何从日常日志中获取不同的记录数 [英] How to get distinct record count from everyday log
问题描述
你好,我有以下数据...从这里我想要每天激活的用户数及其最新激活时间...
ID状态日期日月年
2962 Y 2015-08-21 14:16:25.113 21 8 2015
2963 Y 2015-08-21 15:15:26.013 21 8 2015
2962 Y 2015-08-21 15:15:28.113 21 8 2015
2964 Y 2015-08-21 15:16:58.117 21 8 2015
2909 Y 2015-08-21 15:16:59.820 21 8 2015
2964 Y 2015-08-24 12:46:55.850 24 8 2015
2908 Y 2015-08-24 12:46:57.877 24 8 2015
2963 Y 2015-08-24 12:46:59.600 24 8 2015
2841 Y 2015-08 -24 13:11:13.513 24 8 2015
2840 Y 2015-08-24 13:11:15.323 24 8 2015
2839 Y 2015-08-24 13: 11:17.297 24 8 2015
2838 Y 2015-08-24 13:11:19.270 24 8 2015
2778 Y 2015-08-24 13:11:21.283 24 2015年8月
2 778 Y 2015-08-24 13:12:49.293 24 8 2015
2838 Y 2015-08-24 13:12:51.353 24 8 2015
2839 Y 2015- 08-24 13:12:53.030 24 8 2015
2840 Y 2015-08-24 13:12:55.220 24 8 2015
2841 Y 2015-08-24 13 :12:57.093 24 8 2015
2908 Y 2015-08-24 13:12:59.110 24 8 2015
2909 Y 2015-08-24 13:13:01.187 24 8 2015
结果我想要
date活跃用户
2015-08-24 4
2015-08-21 2
Hello there i have following data ... from this i want count of user activated on each day with its latest activated time...
ID Status Date Day Month Year
2962 Y 2015-08-21 14:16:25.113 21 8 2015
2963 Y 2015-08-21 15:15:26.013 21 8 2015
2962 Y 2015-08-21 15:15:28.113 21 8 2015
2964 Y 2015-08-21 15:16:58.117 21 8 2015
2909 Y 2015-08-21 15:16:59.820 21 8 2015
2964 Y 2015-08-24 12:46:55.850 24 8 2015
2908 Y 2015-08-24 12:46:57.877 24 8 2015
2963 Y 2015-08-24 12:46:59.600 24 8 2015
2841 Y 2015-08-24 13:11:13.513 24 8 2015
2840 Y 2015-08-24 13:11:15.323 24 8 2015
2839 Y 2015-08-24 13:11:17.297 24 8 2015
2838 Y 2015-08-24 13:11:19.270 24 8 2015
2778 Y 2015-08-24 13:11:21.283 24 8 2015
2778 Y 2015-08-24 13:12:49.293 24 8 2015
2838 Y 2015-08-24 13:12:51.353 24 8 2015
2839 Y 2015-08-24 13:12:53.030 24 8 2015
2840 Y 2015-08-24 13:12:55.220 24 8 2015
2841 Y 2015-08-24 13:12:57.093 24 8 2015
2908 Y 2015-08-24 13:12:59.110 24 8 2015
2909 Y 2015-08-24 13:13:01.187 24 8 2015
Result i want as
date Active users
2015-08-24 4
2015-08-21 2
推荐答案
Hi Devraj,
请尝试以下查询
Hi Devraj,
Please try below query
SELECT Convert(date,[Date]),Count(Id) FROM [Table]
Where Status = 'Y'
GROUP BY Convert(date,[Date]),Status
这里内部转换第一个日期是关键字日期,第二个[日期]是你的字段名称。
将显示输出,日期显示有效用户数。
如果您有任何疑虑或疑问,请告诉我在此或如果我遗失了什么。
谢谢
Here inside convert first date is keyword date and second [Date] is your field name.
The output will be shown, date wise active user count.
Please let me know if you have any concern or query on this or if I am missing something.
Thanks
这篇关于如何从日常日志中获取不同的记录数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!