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

  • Home
  • SEARCH
  • 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 6932473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:42:38+00:00 2026-05-27T11:42:38+00:00

I am trying to filter the count of Rows found, per hour, over the

  • 0

I am trying to filter the count of Rows found, per hour, over the past 24 hours.

I am using the following SQL query and ‘landtime’ is a DateTime field.

SELECT HOUR(landtime) as hour, COUNT(*) as total FROM ord_log WHERE landtime > DATE_SUB(NOW(), INTERVAL 24 HOUR) GROUP BY HOUR(landtime) ORDER BY HOUR(landtime)

Sample data set > http://pastebin.com/0rYBnePG

The results looked as expected, until I looked at the data it was using.

It was pulling dates from days/weeks before todays date when I only want a count for the past 24 hours.

Any help appreciated!

  • 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-05-27T11:42:38+00:00Added an answer on May 27, 2026 at 11:42 am

    No need to use a function, just use simple math:

    SELECT HOUR(landtime) as hour, COUNT(*) as total FROM ord_log WHERE landtime > (CURRENT_TIMESTAMP - INTERVAL 1 DAY) GROUP BY HOUR(landtime) ORDER BY HOUR(landtime)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get the wp posts using custom query. Here is sql
I am using the following url to stream twitter data. http://stream.twitter.com/1/statuses/filter.json?count=-150&follow=16256661&track=indiana Without the count
I have an SQL Server query that needs to count the number of rows
Im trying to filter rows based on a column say c1 that contains boolean
I am trying to filter a fusion table using the WHERE clause in order
I'm trying to filter a datatable with following code private void Filter(string text) {
I'm trying to filter some XML in JavaScript using E4X and have some specific
I'm trying to filter by a list of values using the criteria API. I
I've got a query that looks like this affiliates = User.objects.annotate(referral_count=Count('referrals')) .filter(referral_count__gt=0) But when
I'm trying to set up a filter query in one of my views...basically my

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.