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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:20:39+00:00 2026-06-12T11:20:39+00:00

I have a MYSQL DB with two columns, one is the temperature and the

  • 0

I have a MYSQL DB with two columns, one is the temperature and the other one is the time in which the temperatura was read, like http://pastebin.mozilla.org/1860064 .
The temperature USUALLY have a 5minutes difference between reads, but this is not always with this time gap.

What I need to figure out is a algorithm to read all the values and save the average of every hour of read, so temperature will be saved on the db with one temperature per hour, 24 reads per day, and it would save in another db’s table.

For example:

enter image description here

It would save with the average temperature and with the date 2012-10-07 10:00:00,

Was I clear?

  • 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-12T11:20:41+00:00Added an answer on June 12, 2026 at 11:20 am

    Here is one way to do this with just a query. If you need the results stored in the database you’ll need your own inserts but this will get you the data you’re looking for.

    SELECT AVG(temperature),HOUR(read_time) as read_hour FROM temperature_reads WHERE DATE(read_time) = '2012-10-06' GROUP BY read_hour
    

    You can swap the 2012-10-06 part out for whatever date you are looking at.

    Edit: Here it is updated with your info:

    SELECT AVG(temperatura),HOUR(data) as read_hour FROM leituras WHERE DATE(read_time) = '2012-10-06' GROUP BY read_hour
    

    This should do the trick!

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

Sidebar

Related Questions

Using PHP / MySQL I have two tables one is customers the other is
I'm using mysql have two columns in a table one is date_added and the
Okay, so let's say I have a mysql database table with two columns, one
I have a mysql table with two columns - one containing a year in
I have a database in MySql with two columns, one where the user's name
Here is my scenario: I have two MySQL tables: Categories (columns: id, category) Items
I have two MySQL tables something like this: tool_owners: tool_owners_id | user_id | ...
I have two mysql queries: $sql = SELECT * FROM content WHERE threadName LIKE
I have one MySQL table, users , with the following columns: user_id (PK) email
I have two tables in MySQL, one containing a field City and one containing

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.