SELECT offers.id FROM提供WHERE offers.user_id!=' 2'和offers.id不在(从notifications_offers.user_id =' 2')中选择notifications_offers.offer_id from informed_offers;
答案 0 :(得分:0)
如果您已关联Offers
和NotifiedOffers
模型,并且它不是多对多关联,则可以执行以下操作:
Offers.findAll({
attributes: ['id'],
where: {
user_id: {
not: 2
}
},
include: {
model: NotifiedOffers,
where: {
user_id: {
not: 2
}
},
required: true
}
});