我需要获取属性“type1”、“type2”等“不等于‘null’”和“不等于字符串‘no_issue’”的数据。我尝试了几种不同的方法但没有运气,这就是我目前无法使用的方法:
[Op.and]: [
{ type1: { [Op.not]: null }},
{ type1: { [Op.ne]: 'no_issue' }},
{ next_item: 'next' }
],
[Op.and]: [
{ type2: { [Op.not]: null }},
{ type2: { [Op.ne]: 'no_issue' }},
{ next_item: 'next' }
],
[Op.and]: [
{ type3: { [Op.not]: null }},
{ type3: { [Op.ne]: 'no_issue' }},
{ next_item: 'next' }
],
[Op.and]: [
{ type4: { [Op.not]: null }},
{ type4: { [Op.ne]: 'no_issue' }},
{ next_item: 'next' }
],
[Op.and]: [
{ type5: { [Op.not]: null }},
{ type5: { [Op.ne]: 'no_issue' }},
{ next_item: 'next' }
]
}
这看起来是正确的,但我显然错过了一些东西。提前致谢!
最佳答案
Op.and
应该是一个对象数组
[Op.and]: [
{ type1: { [Op.not]: null }},
{ type1: { [Op.ne]: 'no_issue' }}
],...
关于node.js - 如何使用 Sequelize 查询 WHERE "NOT NULL"AND "NOT EQUAL TO [STRING]"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67909955/