mybatis where语句多条件查询报错问题
程序员文章站
2022-03-11 18:44:41
...
今天在使用mybatis,把写好的SQL语句放入navicat里面运行完全没有问题,但是在项目里面跑就会报错。。
SQL语句:
SELECT u.Name AS userName,
sum( rec.Duration )duration, rec.UserId AS userId,
round( sum( cal.Caloric * ( rec.Duration / 60 ) ) ) AS calNum
FROM sport_record rec
JOIN sport_caloric cal ON rec.Item = cal.ID
JOIN user u ON rec.UserId = u.ID
WHERE rec.RecordDate = '2020-06-08' //======注意这里
AND rec.UserId = 659
GROUP BY rec.UserId, u.Name
放到mapper里一直报如上错误…
最终我把 WHERE语句的两个条件位置呼唤了一下,就解决了
WHERE rec.UserId = 659 AND rec.RecordDate = '2020-06-08'
网上搜了一圈未找到同款 ,,,在此记录一下
不知道这是有我忽略的知识点还是mybatis的bug?求大佬赐教