How can use LEFT JOIN at Sequelize?

前端 未结 2 923
走了就别回头了
走了就别回头了 2020-12-14 17:17

Relations:

Shop.hasMany(ShopAd, {foreignKey : \'shop_id\', as : \'ads\'});
ShopAd.belongsTo(Shop, {foreignKey : \'id\'})

I using :

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 17:37

    required: true forces an INNER JOIN, use required: false to force a LEFT JOIN.

    Taken from here.

提交回复
热议问题