spring-mybatis - Mybatis String <= />= 字符串比较问题
问题描述
在 SQL 中:能够返回结果
SELECT * from result where
(reportDate >= "2022-02-06" and reportDate <= "2022-02-13")
Mybatis中示例1:能够返回结果
SELECT * from result where
(reportDate >= "2022-02-06" and reportDate <= "2022-02-13")
Mybatis example2中:无法返回结果。
SELECT * from result where
(reportDate >= #{startDate,jdbcType=VARCHAR} and reportDate <= #{endDate,jdbcType=VARCHAR})
在 String 中 startDate 设置为“2022-02-06”,endDate 设置为“2022-02-13”。myBatis有没有办法比较String,或者我应该如何转换startDate和endDate?SQL 表中的 reportDate 也在 VARCHAR 中。
解决方案
推荐阅读
- php - Laravel 8 - MS SQL - 查询生成器 - 使用 DB Raw。尝试使代码正确,使其像工作的 MSSQL 代码一样工作
- visual-studio - 如何区分消息是来自 ReSharper 还是 Visual Studio
- php - 如何在PHP的同一页面中的while循环之外传递值?
- java - Weblogic:logback线程没有被移除,然后war应用程序被从weblogic中移除
- node.js - ResponseError:Confluent_Schema_Registry - 错误,状态 400
- amazon-web-services - 在 Twilio 代理服务上录制语音通话的最佳方式是什么?
- linux - 比较linux中的两个文件?
- c++ - 使用 C++ Builder 和 ADOX 创建 SQL Server *.MDF 文件
- python - Python遍历存储在变量中的每个单独列表并将其作为单个列表
- python - 索引和保存大型 xarray 数据集并写入文件的最佳方法