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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:59:15+00:00 2026-05-28T17:59:15+00:00

As the title says, the row count differs when doing a select using DATE

  • 0

As the title says, the row count differs when doing a select using DATE and DATETIME. Please advise.

I’m trying to select rows between 1st and 5th Jan, 2012. The date column datatype is bigint (UNIX timestamp).

select * from table_name
where sample_timestamp between unix_timestamp('2012-01-01')*1000 and unix_timestamp('2012-01-05')*1000 

If I include the time in HH:MM:SS, the rows returned are correct i.e.

select * from table_name
where sample_timestamp between unix_timestamp('2012-01-01 00:00:00')*1000 and unix_timestamp('2012-01-05 23:59:59')*1000 

Any input will be much appreciated. 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-05-28T17:59:15+00:00Added an answer on May 28, 2026 at 5:59 pm

    ‘2012-01-05’ is actually ‘2012-01-05 00:00:00’ which is not what you’re writing in the second select.

    I suspect what you mean to do is

    select * from table_name 
    where sample_timestamp >= unix_timestamp('2012-01-01')*1000 
    and sample_timestamp < unix_timestamp('2012-01-06')*1000
    

    which as a bonus handles leap seconds correctly too 🙂

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

Sidebar

Related Questions

As the title says, I'm trying to make a cell for each row a
Title says what i'm trying to do. I can successfully generate an assembly if
Title says it all: What is the difference between a UserTransaction and an EntityTransaction
As the title says :) In my database the table I'm using has an
Title says it pretty much all... I'm trying to automate tests on a web
As title says, I'm currently doing some small hacks with pointers in C++, but
As the title says, is it recommended to remove Data Row from Data Table
The title says it - What happens between TestMethods in MS Visual Studio Unit
Title says it mostly. I want to add a simple extension method to the
Question title says it all really - a lot slower than VS2005, with a

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.