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 8893349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:13:29+00:00 2026-06-14T23:13:29+00:00

I have a query with the fields date hour and value . It looks

  • 0

I have a query with the fields date hour and value.
It looks something like this

    date       hour   value 
    xx/xx/xx     15     100
    xx/xx/xx     30     122
    xx/xx/xx     45      50
    ...         100     100
    ...         115      23
    ...         ...     ...
    ...         ...     ...
    ...        2400     400
    ...          15      23

Basically, date is the date, hour is the hour, and value is the value for that particular 15 minute interval. What I have been trying to figure out is a way to take each hour (so 15, 30, 45, and 100) or (1015, 1030, 1045, 1100) [As you can see hours are military-esque 1:00pm is 1300 and midnight 2400], and sum their values together. So i am looking to return something like this:

    xx/xx/xx    100     372
    xx/xx/xx    200     23 + (130 data) + (145 data) + (200 data)

And so on…
The table has on average around 100 days and they all start from 15 to 2400 incrementing by 15 with varying numbers for the value column.

I have thought about using a partition, group by, etc. with no real ideas how to tackle it. Essentially I have to take 4 rows (an hour), sum their values, spit out the date, hour, and summed value then repeat for every day. I am not asking for code, just some help with what i should be using since this seems like a simple problem minus the key to solving it.

Any help is greatly appreciated, 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-06-14T23:13:31+00:00Added an answer on June 14, 2026 at 11:13 pm

    Grouping by Hour/100 will almost get you there – subtract 1 from the hour will make 1 AM fall to 99, and get included in the grouping. This will give a query that looks like this:

    SELECT Table1.Dte, Int(([tme]-1)/100) AS Hr, Sum(Table1.Val) AS TotVal
    FROM Table1
    GROUP BY Table1.Dte, Int(([tme]-1)/100);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a field with enums: 'preview','active','closed' When I query like this: $query =
in the past hour i have been trying different variants of this query but
I have 2 important date fields in db. startTime and goTime I like to
I have a query like this: Select E.ID, E.NAME, date_format( CONVERT_TZ( CONVERT_TZ( E.ST, '+00:00',
is it possible to count fields where something? I have following query: SELECT *
Hi i have a table with the following fields 'Site Code' 'Date' 'Hour' 'Quantity'
I have table with about 100+ fields. There are a number of date fields
I have a query that produces a result like this: The data is sorted
I have a date field in a query and I do want to get
I have the field: APP_DATE (smalldatetime) I'm doing this query: INSERT INTO table (TYPE,

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.