MySql中datetime使用BETWEEN,AND中无效的问题

  • between and 在sql结尾无效, 移到where开头有效,原因待查
  • 最终发现是sql有问题
    1
    select * from t1 where isnull(t1.a) or t1.a = '' and now() between t1.start_date and t2.end_date
    改为
    1
    select * from t1 where (isnull(t1.a) or t1.a = '') and now() between t1.start_date and t2.end_date