如何按日期段查询数据?
一开始是这么写的。
远程给修改了。${if(len(ksrq) == 0,"","and datediff(day,a.DocDate,CAST('"+ksrq+"' as date))<=0")}${if(len(jsrq) == 0,"","and datediff(day,a.DocDate,CAST('"+jsrq+"' as date))>=0")}
${if(len(time)==0,""," and 日期 >='"+time+"'")} ${if(len(time1)==0,""," and 日期 <='"+time1+"'")} 这样设置不选日期可以显示全部
把日期设为参数
设置开始日期和结束日期两个参数
select * from 表名 where 日期 >='${date1}' and 日期 <='${date2}'