gpt4 book ai didi

bookshelf.js - 在 bookshelf.js 中执行 where in 查询

转载 作者:行者123 更新时间:2023-12-04 04:18:58 25 4
gpt4 key购买 nike

我要表演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'

代码
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}})

关于bookshelf.js - 在 bookshelf.js 中执行 where in 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36131004/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com