Solved

SQL SERVER - Group by  15 minute increments

Posted on 2013-12-03
1
352 Views
Last Modified: 2013-12-03
Hi..
I have a timestamp column - how can I group the records by 15 minutes increments?
I need to sum the records for each 15 minutes.
thx
0
Comment
Question by:JElster
1 Comment
 
LVL 11

Accepted Solution

by:
jasonduan earned 500 total points
ID: 39693021
Try this:

SELECT
  DATEADD(minute, DATEDIFF(minute, '1900-01-01', DateOrdered) /15 * 15, '1900-01-01')
  ,  SUM(OrderAmt)
FROM YourTable
GROUP BY
   DATEADD(minute, DATEDIFF(minute, '1900-01-01', DateOrdered) /15 * 15, '1900-01-01')

Open in new window

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now