org.springframework.jdbc.UncategorizedSQLException:
Error querying database. Cause: java.sql.SQLException: Incorrect DATE value: ‘2020-03%’
The error may exist in class path resource [clubatis/set/PaibanMapper.xml]
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: select UnitGuid
,UGuid
,UName
,AddDate
,DGuid
,DCode
,DName
,MenDianName
,MenDianGuid
,PaiBanDate
,JiShiName
,JiShiGuid
,BanCiCode
,StartTime
,EndTime
from paiban WHERE PaiBanDate like ? and TenantID = ? order by paibandate desc
Cause: java.sql.SQLException: Incorrect DATE value: ‘2020-03%’ ; uncategorized SQLException; SQL state [HY000]; error code [1525]; Incorrect DATE value: ‘2020-03%’; nested exception is java.sql.SQLException: Incorrect DATE value: ‘2020-03%’
解决方法:
时间模糊查询不能用like,可以使用date_format(PaiBanDate,’%Y-%m’)