SELECT count(*) FROM ccs_comp_claim t, ccs_loan t2WHERE t.ref_nbr = t2.ref_nbr AND t.finish_date is null AND t.cooperator_id = 'DYBANK' AND t2.union_insu_case_date <![CDATA[ < ]]> #{countDate,jdbcType=TIMESTAMP},如上sql的countDate为参数,要实现union_insu_case_date加1天小于countDate
时间: 2023-11-28 19:48:05 浏览: 77
你可以使用DATEADD()函数来实现将union_insu_case_date加1天的操作,然后再将其与countDate进行比较,如下所示:
```
SELECT count(*)
FROM ccs_comp_claim t, ccs_loan t2
WHERE t.ref_nbr = t2.ref_nbr
AND t.finish_date is null
AND t.cooperator_id = 'DYBANK'
AND DATEADD(day, 1, t2.union_insu_case_date) < #{countDate,jdbcType=TIMESTAMP}
```
在上述代码中,`DATEADD(day, 1, t2.union_insu_case_date)`表示将`t2.union_insu_case_date`加1天。然后将其与`#{countDate,jdbcType=TIMESTAMP}`进行比较来完成你所需的功能。
相关问题
SELECT count(*) FROM ccs_comp_claim t, ccs_loan t2WHERE t.ref_nbr = t2.ref_nbr AND t.finish_date is null AND t.cooperator_id = 'DYBANK' AND t2.union_insu_case_date <![CDATA[ < ]]> #{countDate,jdbcType=TIMESTAMP},如上sql的countDate为参数,要实现union_insu_case_date小于countDate加1天
可以使用DATEADD函数来实现:
```
SELECT count(*)
FROM ccs_comp_claim t, ccs_loan t2
WHERE t.ref_nbr = t2.ref_nbr
AND t.finish_date is null
AND t.cooperator_id = 'DYBANK'
AND t2.union_insu_case_date < DATEADD(day, 1, #{countDate,jdbcType=TIMESTAMP})
```
这里使用了DATEADD函数来将countDate加上1天,然后与union_insu_case_date进行比较。
阅读全文
相关推荐
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![none](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)