sequelize.js - 如何用一个查询在两列中搜索
问题描述
如果一对一不为空或返回值不为零,则有必要查看两列。如果 mURL === "string" 和 aURL === NULL 返回值
{
logging: console.log,
attributes: ['firstName','lastName','email','mURL','aURL'],
where: {
mURL: {
$not: null
},
aURL: {
$not: null
}
},
include: [
{ all: true, nested: true }
]
}
解决方案
尝试以下 -
{
logging: console.log,
attributes: ['firstName','lastName','email','mURL','aURL'],
where: {
$or: {
mURL: {
$not: null
},
aURL: {
$not: null
}
}
},
include: [
{ all: true, nested: true }
]
}
可以使用$and和$or运算符。
或者你可以使用 -
where: Sequelize.literal(`(mURL IS NOT NULL) OR (aURL IS NOT NULL)`)
推荐阅读
- c++ - 如何让 GNUPlot 以 Cascade 格式打开多个绘图窗口
- java - org.openqa.selenium.WebDriverException:java.net.ConnectException,我该如何解决
- python-3.x - 当列是列表时,如何在数据框中获取重复值?
- python - Python中的findfrequency spec.ar等价物
- amazon-web-services - AWS - 如何为 fifo lambda 创建事件源映射?
- postgresql - 在 PostgreSQL 中复制 Oracle 的 `TRUNC(DATE, 'WW')` 行为
- azure - 从 UI 定义 AKS pod-cidr
- python - Python 程序在通过 Windows 服务运行时崩溃
- matlab - 创建分散笛卡尔数据的网格网格以在球体上绘图
- bash - sed 命令删除无效的 xml 字符不起作用