简体   繁体   中英

Error related to only_full_group_by when executing a query in MySql on Server, working fine on local machine

SELECT new com.example.car.entities.MonthMapper(DATE_FORMAT(car.boughtDate,'%Y-%m'), SUM(total), COUNT(chassis_no)) FROM Car car WHERE DATE_FORMAT(car.boughtDate,'%Y/%m') >= DATE_FORMAT(:fromDate,'%Y/%m') GROUP BY DATE_FORMAT(car.boughtDate,'%Y/%m');

As I am already mentioning boughtDate after group by

The published code does not syntax on my local machine. Here's some errors

There's something missing after new SELECT new com com.example.car.entities.MonthMapper is possibly a column which should have a comma after it (DATE_FORMAT(car.boughtDate,'%Y-%m'), SUM(total), COUNT(chassis_no)) is incorrectly bracketed and should be (DATE_FORMAT(car.boughtDate,'%Y-%m')), SUM(total), COUNT(chassis_no)

Also I suspect there are too many nodes in com.example.car.entities.MonthMapper

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM