with hasmant withCount时错误问题

浏览:423 发布日期:2021/04/15 分类:求助交流
tp5.0环境下用 with hasmany wiatcount查询时 命名错误啊 请问怎么解决啊

$details = $this->model
->where(['isshow_status' => 1, 'curriculum.id' => $id])
->with('teachers,curriculumcate')
->withCount('curriculumlikes')->find();
下面是错误片段:
WHERE
( `curriculum_id` = fa_curriculum.id )
LIMIT 1
) AS `curriculumlikes_count`
FROM
`fa_curriculum` `curriculum`
LEFT JOIN `fa_teachers` `teachers` ON `curriculum`.`teachers_id` = `teachers`.`id`
LEFT JOIN `fa_curriculum_cate` `curriculumcate` ON `curriculum`.`curriculum_cate_id` = `curriculumcate`.`id`
WHERE
`isshow_status` = 1
AND `curriculum`.`id` = '57'
LIMIT 1
> 1054 - Unknown column 'fa_curriculum.id' in 'where clause'
最佳答案
评论( 相关
后面还有条评论,点击查看>>