Solved

SQL SERVER - Group by  15 minute increments

Posted on 2013-12-03
1
360 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 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