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

  • SEARCH
  • Home
  • 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 6119951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:36:44+00:00 2026-05-23T15:36:44+00:00

To keep things very simple, say I have a SQL Server 2008 table with

  • 0

To keep things very simple, say I have a SQL Server 2008 table with a single column that has a datetime data type. I’d like a query that produces the number of rows for each minute interval. For example, the results would look like this:

7/3/2011 14:00:00 | 1000
7/3/2011 14:01:00 | 1097
7/3/2011 14:02:00 |  569

The first row would mean that 1000 rows have a datetime value between 7/3/2011 13:59:00 and 7/3/2011 14:00:00.

The second row would mean that 1097 rows have a datetime value between 7/3/2011 14:00:00 and 7/3/2011 14:01:00.

The third row would mean that 569 rows have a datetime value between 7/3/2011 14:01:00 and 7/3/2011 14:02:00.

Thank you.

  • 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-05-23T15:36:45+00:00Added an answer on May 23, 2026 at 3:36 pm

    This:

    ;WITH CTE_ExampleData as (
        select stamp = '07/07/2011 14:00:01'
        union select stamp = '07/07/2011 14:00:02'
        union select stamp = '07/07/2011 14:00:03'
        union select stamp = '07/07/2011 14:01:01'
        union select stamp = '07/07/2011 14:01:02'
        union select stamp = '07/07/2011 14:01:03'
        union select stamp = '07/07/2011 14:01:04'
        union select stamp = '07/07/2011 14:02:02'
        union select stamp = '07/07/2011 14:02:03'
        union select stamp = '07/07/2011 14:02:04'
        union select stamp = '07/07/2011 14:02:05'
    )
     select 
        stamp = dateadd(mi,datediff(mi,0,stamp) + 1,0),
        rows = count(1)
     from CTE_ExampleData
     group by dateadd(minute,datediff(mi,0,stamp)+1,0)
    

    Returns

    stamp                       rows
    2011-07-07 14:01:00.000     3
    2011-07-07 14:02:00.000     4
    2011-07-07 14:03:00.000     4
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table a and table b . (SQL Server 2008) Both tables have
To keep things simple, we have a few aspx pages... Page1.aspx - resets Session
If I just want to keep things very simple, and just map my tables
I have a VERY simple C# Winforms project that I made using Visual Studio
I have a CGI script that does a lot things. I'm trying to keep
For various reasons, such as cookies, SEO, and to keep things simple, I would
I want to keep logs of some things that people do in my app,
I keep reading about C99 and C++11 and all these totally sweet things that
I must develop a simple web application to produce reports. I have a single
Very soon I will setting up a web server for a client who has

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.