繁体   English   中英

我如何将查询翻译为续集?

[英]How can i translate query to sequelize?

select reservation_datetime
from LectureReservation
Inner Join Lecture
On LectureReservation.lecture_id = Lecture.id
Where Lecture.mentor_id = 1

这是我的查询,我想将其更改为续集

if (req.params.id) {
            LectureReservation
            .findAll({
                include: [{
                    model: Lecture,
                    where: { mentor_id: req.params.id },
                }],
                attributes: ['reservation_datetime'],
                where: {
                    lecture_id: Lecture.id,
                },

这个..我很努力,但找不到解决方案,我的 postman 不断向我展示

"name": "SequelizeEagerLoadingError"

这个错误。。

请帮我将查询翻译为续集..!

Sequelize 将执行 _outer join 而无需 required = true。

您收到的错误通常来自关联问题。

尝试设置 logging:console.log 并检查原始查询。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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