我如何将查询翻译成续集?
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,
},
这个..我试了好久但找不到解决办法,我的邮递员一直给我看
"name": "SequelizeEagerLoadingError"
这个错误..
请帮助我将查询翻译成 sequelize..!
Sequelize 将在没有 required = true 的情况下执行 _outer join。
您收到的错误通常是关联问题。
尝试设置日志记录:console.log 并检查原始查询。
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,
},
这个..我试了好久但找不到解决办法,我的邮递员一直给我看
"name": "SequelizeEagerLoadingError"
这个错误..
请帮助我将查询翻译成 sequelize..!
Sequelize 将在没有 required = true 的情况下执行 _outer join。
您收到的错误通常是关联问题。
尝试设置日志记录:console.log 并检查原始查询。