0

次のように除外したいものを選択する後続のステートメントがある場合:

e.where("events.user_id in (?) and type = 'Post'", some_ids)

それらを除外するステートメントをどのように書くのですか? 1 行で記述できますか、それとも、それらを保存して ID でそれらのイベントを除外する必要がありますか?

some_ids は user_ids の配列です

4

2 に答える 2

2
e.where("events.user_id not in (?) or type <> 'Post'", some_ids)
于 2013-02-11T03:25:25.693 に答える
0

「存在しない場所」はあなたの好きな言葉です。例えば、

select whatever
from wherever
where not exists 
(subquery goes here)
于 2013-02-11T03:26:14.040 に答える