如何从 sequelize PostgreSQL 中检索除特定值外的所有记录?
how to retrieve all records from sequelize PostgreSQL except a specific value?
我想检索除特定值以外的所有记录,我尝试了以下查询,但没有得到所需的输出。
db.owner.findAll({ exclude: { model : models.owner.name: 'jack'},
include: [{ model: models.customer, as: 'customers' }]
})
这个答案对我有用:
db.owner.findAll({
where: {name: { $not: 'jack'}},
include: [{ model: models.customer, as: 'customers' }]
});
检查这个
db.owner.findAll({({
where : { name: {ne: 'jack'}},
include: [{ model: models.customer, as: 'customers' }]
});
我想检索除特定值以外的所有记录,我尝试了以下查询,但没有得到所需的输出。
db.owner.findAll({ exclude: { model : models.owner.name: 'jack'},
include: [{ model: models.customer, as: 'customers' }]
})
这个答案对我有用:
db.owner.findAll({
where: {name: { $not: 'jack'}},
include: [{ model: models.customer, as: 'customers' }]
});
检查这个
db.owner.findAll({({
where : { name: {ne: 'jack'}},
include: [{ model: models.customer, as: 'customers' }]
});