Answer the question
In order to leave comments, you need to log in
How to implement left join in Sequelize?
Hello I am new to node.js and sequelize. I have a query like this:
SELECT statistics_description.title, accounts_statistics.value
FROM accounts_statistics LEFT JOIN statistics_description
ON accounts_statistics.name = statistics_description.name
Answer the question
In order to leave comments, you need to log in
Use required: false
for left join
AccountsStatisticsModel.findAll({
where: { name: '$StatisticsDescriptionModel.name$' },
include:[
{
model: StatisticsDescriptionModel,
attributes: ['title', 'name'],
required: false,
}
],
attributes: ['value', 'name'],
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question