I have an sql search query in my rails app:
patients = patients.where("thisyear < last ") if search.present?
My problem is that this search query also disselects database entrys where the :last
is nil
My question is how can i write an search query that does not get applied on patients where the column :last
is nil
? Thanks
patients = patients.where("last IS NULL OR thisyear < last") if search.present?
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.