首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使用Sequelize查询WHERE "NOT NULL“和"NOT EQUAL TO [STRING]”?

如何使用Sequelize查询WHERE "NOT NULL“和"NOT EQUAL TO [STRING]”?
EN

Stack Overflow用户
提问于 2021-06-10 02:37:33
回答 1查看 45关注 0票数 0

我需要获取属性"type1“、"type2”等“不等于'null'”和“不等于字符串'no_issue'”的数据。我已经尝试了几种不同的方法,但都没有成功,这就是我目前所拥有的不起作用的方法:

代码语言:javascript
运行
复制
  [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' }
    ]
    }

这看起来是正确的,但我显然遗漏了一些东西。提前感谢!

EN

Stack Overflow用户

发布于 2021-06-10 03:15:06

Op.and应为对象数组

代码语言:javascript
运行
复制
      [Op.and]: [
         { type1: { [Op.not]: null }},
         { type1: { [Op.ne]: 'no_issue' }}
      ],...
票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67909955

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档