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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:35:02+00:00 2026-06-17T07:35:02+00:00

I have a temporal database and I want to perform the temporal aggregation via

  • 0

I have a temporal database and I want to perform the temporal aggregation via average function on time series data by using data in time sequence of following:

Hourly average of HH= (HH-1):51, HH:01, HH:11, HH:21, HH:31, HH:41.

Moreover, aforementioned values are instantaneous values.

Sample data:

    ambtemp      ddate_ttime
1     -1.42 2007-09-28 23:39:09
2     -1.24 2007-09-28 23:41:09
3     -1.28 2007-09-28 23:43:09
4     -1.28 2007-09-28 23:45:09
5     -1.24 2007-09-28 23:47:09
6     -1.42 2007-09-28 23:49:09
7     -1.68 2007-09-28 23:51:09
8     -1.76 2007-09-28 23:53:09
9     -1.96 2007-09-28 23:55:09
10    -2.02 2007-09-28 23:57:09
11    -1.92 2007-09-28 23:59:09
12    -1.64 2007-09-29 00:01:09
13    -1.76 2007-09-29 00:03:09
14    -1.83 2007-09-29 00:05:09
15    -1.86 2007-09-29 00:07:09
16    -1.94 2007-09-29 00:09:09
17    -1.87 2007-09-29 00:11:09
18    -1.87 2007-09-29 00:13:09
19    -1.80 2007-09-29 00:15:09
20    -1.64 2007-09-29 00:17:09
21    -1.60 2007-09-29 00:19:09
22    -1.90 2007-09-29 00:21:09
23    -2.08 2007-09-29 00:23:09
24    -1.94 2007-09-29 00:25:09
25    -2.12 2007-09-29 00:27:09
26    -1.87 2007-09-29 00:29:09
27    -2.18 2007-09-29 00:31:09
28    -1.98 2007-09-29 00:33:09
29    -1.73 2007-09-29 00:35:09
30    -1.84 2007-09-29 00:37:09
31    -2.04 2007-09-29 00:39:09
32    -1.86 2007-09-29 00:41:09
33    -1.94 2007-09-29 00:43:09
34    -1.77 2007-09-29 00:45:09

And Expected results:

Hourly mean for 0:00 = average of values of (23:51, 0:01, 0:11, 0:21, 0:31, 0:41)

Hourly mean 0:00 = (-1.68+-1.64+-1.87+-1.90+-2.18+-1.86)/6

  • 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-17T07:35:03+00:00Added an answer on June 17, 2026 at 7:35 am
    select dt, average_temp
    from (
        select
            date_trunc('hour', ddate_ttime + interval '10 minutes') dt,
            avg(ambtemp) over(
                partition by date_trunc('hour', ddate_ttime + interval '10 minutes')
            ) average_temp
        from sample
        where extract(minute from ddate_ttime) in (51, 01, 11, 21, 31, 41)
    ) s
    group by 1, 2
    order by dt
    

    SQL Fiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have temporal database and I wanted to obtain hourly average for time series
I want to implement a temporal database using mysql. I have found out that
I am working on a Java implementation for temporal aggregation using a PostgreSQL database.
I have bunch of temporal data which I want to convert to RDF format.
I have a temporal database and I wanted to create a subset based on
I'm studying the best data structures to implement a simple open-source object temporal database,
I have this date in a PostgreSQL 9.1 database in a timestamp without time
I have a spatio-temporal database in Postgresql that is continuously updates. I was wondering
If I have a function that returns a temporal table, how do I set
I have a view in SQL, and I want to select some data depending

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.