<!-- Date或者Time是stamp不能与空''字符串比较,会抛异常 -->
<if test="marketdateStart != null and marketdateEnd != null" >
and MARKETDATE between #{marketdateStart} and #{marketdateEnd}
</if>
本文介绍了一种在数据库查询中使用日期范围作为过滤条件的方法。通过解析提供的代码片段,我们了解到如何利用IF标签来判断市场日期的开始和结束是否为空,并据此构建相应的SQL查询语句。
<!-- Date或者Time是stamp不能与空''字符串比较,会抛异常 -->
<if test="marketdateStart != null and marketdateEnd != null" >
and MARKETDATE between #{marketdateStart} and #{marketdateEnd}
</if>
2164
1678

被折叠的 条评论
为什么被折叠?