Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8684639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:21:31+00:00 2026-06-12T22:21:31+00:00

Very closely related to SQL – Select most 'active' timespan fromdb but different question.

  • 0

Very closely related to SQL – Select most 'active' timespan fromdb but different question.

“I have a table of transactions. In this table I store the transaction datetime in UTC. I have a few months of data, about 20,000 transactions a day.”

How would change

  select datepart(hour, the_column) as [hour], count(*) as total 
  from t 
  group by datepart(hour, the_column) 
  order by total desc

so that I can select the specific year, month, day, hour, minute, and second that was the most ‘active’.

To clarify, I’m not looking for which hour or minute of the day was most active. Rather, which moment in time was the most active.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:21:32+00:00Added an answer on June 12, 2026 at 10:21 pm
    Select 
        DATEPART(year, the_column) as year
        ,DATEPART(dayofyear,the_column) as day
        ,DATEPART(hh, the_column) as hour
        ,DATEPART(mi,the_column) as minute
        ,DATEPART(ss, the_column) as second
        ,count(*) as count from t
    Group By 
        DATEPART(year, the_column)
        , DATEPART(dayofyear,the_column)    
        , DATEPART(hh, the_column)
        , DATEPART(mi,the_column)
        , DATEPART(ss, the_column)
    order by count desc
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a question very closely related to another question I've seen on
This is closely related to anothewr question I have asked but since this is
This is very closely related to this other question , but that question wanted
Very simple + silly question: Does clojure provide multi maps? I currently have something
Very simple question... I have an array of pixels, how do I display them
Very noob question, I know, but I didn't manage to handle real-time slider move
I'm building an app which consists of different views which are closely related to
I have a question which closely relates to this question . In my schema
This question comes very closely to what I'm after: Replace an Attribute in the
I suppose this is two very closely related questions: Everyone says to start with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.