Where condition for joined table in Sequelize ORM
Wrap the columns which reference joined tables in $$
A.findAll({
where: {
$or: [
{'$B.userId$' : 100},
{'$C.userId$' : 100}
]
},
include: [{
model: B,
required: false
}, {
model: C,
required: false
}]
});
Add the where condition in the include, along with join.
{
model: C,
where: {
id: 1
}
}