MySQL Forums
Forum List  »  General

Date compare issue
Posted by: Jack Tullous
Date: February 21, 2020 03:07PM

I have this table that has a datetime column and i'm just trying to count the records of what is before Now. manually counting the total rows is 5. 4 have a greater day of now and 1 a past date.

So I am using the following query:

select COUNT(*) from table1 where stas="test" and sdate > Now();

results 4

if I flip the query to:

select COUNT(*) from table1 where stas="test" and sdate < Now();

results 5. "I feel this should result in 1"

Why is this not resulting 1 by chance?

Options: ReplyQuote


Subject
Written By
Posted
Date compare issue
February 21, 2020 03:07PM
February 21, 2020 07:46PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.