I want to get all records from table Binaryfile
where Binaryfile.id
is not in Image.fullimage_id
and not in Image.preview_id
and not in Image.thumbnail_id
I tried with the following, but I get all records from Binaryfile
which are not in Image.fullimage_id
or not in Image.preview_id
or not in Image.thumbnail_id
binaryfiles = Binaryfile.where('id NOT IN (?)', [Image.select("fullimage_id"), Image.select("preview_id"), Image.select("thumbnail_id")])
How can I change the condition from or
to and
?
Binaryfile.where.not(id: Image.pluck(:fullimage_id, :preview_id, :thumbnail_id).flatten)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.