sequelize left outer join code example
Example 1: left join in sequelize
Shop.findAll({
where:{id:shopId},
include:[
{ model:ShopAd, as:'ads',
where:{
is_valid:1,
is_vertify:1},
required:false
}
]
})
.success(function(result) {
callback(result);
});
Example 2: sequelize left join attributes
Users.findAll({
include: [
{
model: Role,
as: 'roles',
attributes: ['columnNameToInclude']
}
]
});