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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:39:53+00:00 2026-06-03T16:39:53+00:00

My database record is partly shown below, i want to use a sql to

  • 0

My database record is partly shown below, i want to use a sql to get records between a period of time in each day.
Such as i want get 01:00 - 03:00 in below records, i expect to get 2004/8/7 01:54, 2004/8/11 02:41, how should i do? Thanks:)

2004/8/7 01:54
2004/8/7 16:44
2004/8/7 22:26
2004/8/9 16:26
2004/8/9 16:26
2004/8/9 18:36
2004/8/9 18:36
2004/8/9 18:36
2004/8/9 18:36
2004/8/10 23:22
2004/8/10 23:23
2004/8/11 02:41
2004/8/12 21:05
  • 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-03T16:39:55+00:00Added an answer on June 3, 2026 at 4:39 pm

    The HOUR() function gives you the hour of day. The rest is easy:

    select * from mytable
    where (hour(datetime_column) between 1 and 2
      or (hour(datetime_column) = 3 
        and minute(datetime_column) = 0
        and second(datetime_column) = 0))
    

    Edited:

    Note that hour(datetime_column) between 1 and 2 matches ... 01:00:00 to ... 02:59:59 and the rest matches the one other second remaining – exactly 03:00:00.

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

Sidebar

Related Questions

Suppose you want to get a record from database which returns a large amount
I have a database that keeps record history. For each update to a record,
I have a MySql database that stores a timestamp for each record I insert.
I'm designing a SQL Server 2005 database for a bank to hold records relating
I have an SQL database, which is a feeder table. I put records in
I'm looking for the simplest possible solution to get mysql database records as XML
I want to require/include a content from database record, but require/include only accepts files.
I have a UTC DateTime value coming from a database record. I also have
How do you make your application aware that a database record was changed or
I currently have this code which reads the first field in a database record

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.