在 bookshelf.js 中执行 where in 查询

2024-05-12

我想表演一个WHERE - IN查询/操作但正常但出现错误。

我要这个

select * from `calendar_event_rsvp` where `event_id` in ('1', '2', '3')

但下面的代码导致

select * from `calendar_event_rsvp` where `event_id in` = '1', '2', '3'

Code

CalendarEventRSVP.forge()
                .where({
                    "event_id": event_ids
                })

我如何在 bookshelf.js 中执行此操作


尝试添加运算符:

CalendarEventRSVP.forge()
            .where('event_id', 'in', event_ids)

或者使用 knex 的whereIn:

 CalendarEventRSVP.forge()
            .query({whereIn: {event_id: event_ids}})
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 bookshelf.js 中执行 where in 查询 的相关文章

  • 如何读取 GPU 负载?

    我正在编写一个程序 用于监控计算机的各种资源 例如CPU使用率等 我还想监控 GPU 使用情况 GPU 负载 而不是温度 using System using System Collections Generic using System
  • python pandas将文本中的数字提取到新列

    我有以下文字column A A hellothere 3 43 hellothere 3 9 我想extract仅另一个新列 B A 旁边 的数字 例如 B 3 43 3 9 I use str extract d d d expand
  • 如何防止 Internet Explorer 连接超时?

    如果网站处理和加载页面的时间超过 10 秒 Internet Explorer将做一个connection timeout 用户可以通过将注册表中的默认值设置为更高的值来防止这种情况发生 但我真的不能告诉我的任何客户这样做 所以我如何首先防
  • 如何用 C# 编写自己的包装器?

    在我的另一个问题中 我一直在尝试寻找知道在哪里可以找到免费的 C 开源 OCR 库的人 然而 似乎只有 C 库 显然 C 不是 C 其中一个回复建议用 C 编写我自己的包装器 我几乎不知道如何做到这一点 在哪里学习如何做到这一点 或者它实际

随机推荐