SELECT DISTINCT c.id,
c.author,
c.title,
....... ,
r.avgScore as `rateScore`, r.`rateCount` ,
f.id as mediaId , f.type as mediaType, f.data as cover
FROM `manga_comic` as c
LEFT JOIN (
Select entityId, AVG(r0.score) as `avgScore`, COUNT(r0.`entityId`) as `rateCount`
FROM `base_rate` as r0
Where r0.`entityType` = 'comic'
GROUP BY r0.`entityType` , r0.`entityId`
) r
ON( c.id = r.`entityId` )
LEFT JOIN entity e on ( `c`.`id` = `e`.`entityId` and e.entityType='comic' and plugin='manga' )
LEFT JOIN media_file f on ( `e`.`id` = `f`.`entityId` and f.type='cover')
WHERE 1
ORDER BY `rateScore` DESC , rateCount DESC
LIMIT 0, 20
感谢e4c5提供的链接,感谢您的时间和支持。
结论:到目前为止,我从mysql 5.7遇到了很多麻烦,因此在将PROD升级到5.7之前,请三思而后行