Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张交易表。在此表中,我将交易日期时间存储为 UTC。我有几个月的数据,每天大约20,000笔交易。
我将如何编写存储过程:
A:最活跃/最繁忙的小时数
B:返回哪个小时最活跃/最忙
select datepart(hour, the_column) as [hour], count(*) as total from t group by datepart(hour, the_column) order by total desc