如果我有一个续集声明,选择我想要排除的内容,如下所示:
e.where("events.user_id in (?) and type = 'Post'", some_ids)
我如何撰写排除这些内容的陈述?我可以在一行中编写它还是必须存储它们并通过id排除这些事件?
some_ids是一个user_ids数组
答案 0 :(得分:2)
e.where("events.user_id not in (?) or type <> 'Post'", some_ids)
答案 1 :(得分:0)
“哪里不存在”是你最喜欢的三个词。例如,
select whatever
from wherever
where not exists
(subquery goes here)