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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:20:10+00:00 2026-06-03T07:20:10+00:00

I have a temperature table, which contains a DATETIME field and a temperature field

  • 0

I have a temperature table, which contains a DATETIME field and a temperature field which is type of float. There are temperature measurements taken every 30 minutes so it’s 48 times a day. What I want to do is to select a date range (eg. 2012-01-01 to 2012-05-01), calculate each day’s average temperature and return the average temperature of each day in the range. Solutions?

Thanks

  • 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-03T07:20:11+00:00Added an answer on June 3, 2026 at 7:20 am

    Use DATE() to strip off the time portion of the datetime field, and use it in the GROUP BY clause for the aggregate AVG() of the temperature column. Your WHERE clause will filter the date range you want to find.

    SELECT
      DATE(temp_date) AS theday,
      AVG(temperature) AS avgtmp
    FROM
      temp_readings
    WHERE DATE(temp_date) BETWEEN '2012-01-01' AND '2012-05-01'
    GROUP BY theday
    

    Note: From your description, it sounds like every day does have readings, but if any day does not appear in your readings table, it will be absent from your result set here.

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

Sidebar

Related Questions

I have one ' Log ' entity which contains information about temperature. I'm trying
I have a temperature measurements stored in a table, each measure have actuall date/time
I have created an SQLite database which has a table which stores temperature values.
I have a Entity with a field which I want to be an Enum.
I have an app which has a section that needs to convert the temperature
I have a master table like CityName, Month, Temperature A,Jan,20 .... A,Dec,1 B,Jan,30 ....
I have a temperature sensor, which is connected using an USB-I2C adapter ( http://www.robot-electronics.co.uk/htm/usb_i2c_tech.htm
I have two time series of data, one which is water temperature and the
I have table with Timestamp, temperature and humidity. I want to have the average
I have a database which stores temperature-logging data from various instruments. Data may be

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.