过滤器不工作的日期 [英] Filter Not Working on date

查看:35
本文介绍了过滤器不工作的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我应用过滤器我正在使用查询,但它在我的情况下不起作用

Please help me in applying a filter I am using a query, but it's not working in my case

SELECT *
FROM transactionList
WHERE transactionDate >= '2018-05-29' AND transactionDate <= '2018-04-29'
LIMIT 20 OFFSET 0

推荐答案

看起来您的日期范围倒退了.您可能打算查找交易发生在 2018 年 4 月 29 日和 2018 年 5 月 29 日之间的所有记录:

It looks like you have the date range backwards. You probably intended to find all records whose transactions took place between 29-April-2018 and 29-May-2018:

SELECT *
FROM transactionList
WHERE transactionDate BETWEEN '2018-04-29' AND '2018-05-29'
LIMIT 20;

请注意,在这种情况下,您可以使用 BETWEEN 运算符,它在两端都包含在内,而不是使用更详细的日期范围措辞方式.

Note that in this case you may use the BETWEEN operator, which is inclusive on both ends, instead of the more verbose way you phrased the date range.

这篇关于过滤器不工作的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆