Hi,
I am facing a problem with the query and hope to see any suggestion on this:
sequelize.models.A.findAll({
include: [{
model: sequelize.models.B,
required: true,
order: ['CreatedOn', 'DESC'],
limit: 1,
include: [{
model: sequelize.models.C,
required: true,
where: { 'AId': { $lt: 6 } }
}]
}]
});
I just only want to find the record of A which has associated record B match the filter specified in record C, if there is no record B unmatched, record of A will not be returned. The query for Sequelize.models.B was generated as a subQuery due to the 'limit' (as I observed), and it was like a left join that if any records of B cannot be found, the record of A is still returned and it has a format like : A.B = [] even the 'required: true'.
How to force it to be an inner Join ?
Thank you.