请解释这个查询的结果

Please explain the result of this query

当我运行这个查询时:

SELECT InwardDate
FROM tblDoc
WHERE InwardDate > DATE() AND (InwardDate IS NOT NULL)

我得到这个结果

5/1/2017

我在数据库中的行的值为:

5/1/2017

所以,5/1/2017 不是 > 5/1/2017,结果应该是没有返回记录。

然后我去试了一下,以防有我看不到的时差:

SELECT DATEDIFF("s", InwardDate, DATE()) AS DiffBetween, InwardDate
FROM tblDoc
WHERE InwardDate > DATE() AND (InwardDate IS NOT NULL)

我得到:

请注意,当我这样做时:

SELECT DATE() FROM tblDoc

我得到:

5/1/2017

我看到第一个查询返回了一个明显不合逻辑的结果,因为数据库中存储的日期与 SQL DATE() 函数返回的日期。我缺少什么?

date() returns 当前发布日期 (4/30/17)。因此,如果它大于今天的日期并且不为空,则返回 Inward 日期。 5/1/17 > 4/30/17 并且不为空,因此它 returns 它。

where I am currently, it is 5/1/2017.

如果是这样,当然会排除该日期的值:

WHERE INWARDDATE > Date() 

the datediff, should have reported a value if the 2 dates were not the same.

嗯,是的,但是您没有返回任何记录,因此没有 datediff。

您看到的值是新记录(*)上 InwardDate 的默认值