android - 在 Android Sqlite 中选择日期之间的查询
问题描述
以上是我的数据截图。如果目录介于开始日期和日期之间,我需要选择目录。我的查询是“ select catalog from hhItemDiscountOne where fromDate >= '20190305' and toDate <= '20190305'
”。但即使日期在范围之间,我也没有得到值。
解决方案
这是我一见钟情时常犯的错误。您正在混合 from 和 to 条件。
没有 fromDate >= '20190305' 的条目,它们都是较小的 '20190301'。因此,如果您正在搜索日期在该范围内的值,则您的条件需要是
fromDate <= '20190305' and toDate >= '20190305'
和<=
被>=
转动
推荐阅读
- python-3.x - 使用 Select_by_value 函数传递字符串变量时出现 InvalidSelectorException
- powerbi - 计算父表中符合条件的行,并且在子表中至少有一条符合条件的记录
- sql-server - smalldatetime 列上的索引
- swift - UISegmentedControl和View切换问题
- azure-service-fabric - 托管标识和 Service Fabric 本地群集
- python - 如何控制python中bin的大小以使用numpy.histogram
- java - com.google.firebase.database.DatabaseException:无法将 java.lang.String 类型的对象转换为 com.example.chocolate.ModelChatlist 类型
- python - 使用python为excel中的一组数据分配不同数字的最简单方法是什么?
- c# - 具有个人帐户和托管 ASP.NET Core 的 Blazor WebAssembly 应用程序 - 对象引用未设置为对象的实例 - AddSigningCredentials
- mysql - 使用 DataGrip 连接到 AWS MySQL 时遇到问题