Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 上次添加的日期未显示在表中_Mysql_Sql - Fatal编程技术网

Mysql 上次添加的日期未显示在表中

Mysql 上次添加的日期未显示在表中,mysql,sql,Mysql,Sql,为什么它没有显示我最近增加的销售额?在我的表数据中,我添加了日期为2021-01-19的销售数据,但在执行查询后,日期为2021-01-19的数据不会显示。我试过这个='2021-01-01'和tsd.sales_date

为什么它没有显示我最近增加的销售额?在我的表数据中,我添加了日期为2021-01-19的销售数据,但在执行查询后,日期为2021-01-19的数据不会显示。我试过这个='2021-01-01'和tsd.sales_date<'2021-01-19') 按tsd.sales\u id分组 结果:

比较日期和日期时间字段时,比较使用日期时间类型。这意味着当您有以下情况时:

WHERE tsd.sales_date < '2021-01-19'
其中tsd.sales\u日期<'2021-01-19'
你的实际情况是:

WHERE tsd.sales_date < '2021-01-19 00:00:00'
其中tsd.sales\u日期<'2021-01-19 00:00:00'
显然,19日的每个时间点都超出了你的比较范围。如果你想包括2021-01-19的一整天,那么你需要检查范围是否小于第二天。e、 g

WHERE tsd.sales_date < '2021-01-20'
其中tsd.sales\u日期<'2021-01-20'

这就是一个例子。我正在使用daterangepicker并将值传递给查询。到目前为止,我只是在测试它。
WHERE tsd.sales_date < '2021-01-20'