我将sequelize与sqlite一起使用,我想
SELECT DISTINCT *
FROM users AS u
LEFT JOIN months AS m ON u.id = m.userid
LEFT JOIN worktimerecords AS w on m.id = w.monthid
WHERE w.projectid = ${id}
…但是使用模型,这是可能的吗?
我试过了
User.findAll({
include: [
{
model: Month,
include: [
{
model: WorkTimeRecord,
where: { projectId: id },
},
],
},
],
})
但是where不起作用,并且返回所有项目的用户,我只希望返回一个项目的用户。
暂无答案!
目前还没有任何答案,快来回答吧!