[英]Select rows where first, last or both characters are special or punctuation, unless they only have a period at the end
[英]where :thisyear > :last unless :last nil?
我的rails應用程序中有一個SQL搜索查詢:
patients = patients.where("thisyear < last ") if search.present?
我的問題是,此搜索查詢還會取消選擇:last
為nil的數據庫條目
我的問題是我該如何寫一個搜索查詢,該查詢不能應用於列:last
為nil
患者? 謝謝
patients = patients.where("last IS NULL OR thisyear < last") if search.present?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.