当前日期的SQLite案例陈述

时间:2013-05-22 18:06:57

标签: sqlite

我正在尝试使用以下内容来确定保修状态 总是不活跃......

case 'Status'
   when current_date between  w.start_date and  w.end_date then 'Active'       
   else 'Inactive'
end

根据建议尝试:

  case 'Status'
   when date('now') between  w.start_date and w.end_date then 'Active' 
   else 'Inactive'

以状态结束

仍然没有..查看数据库和格式中的数据是YYYY-MM-DD

甚至尝试用date()格式包装列..

这不应该是脑部手术......

enter image description here

我注意到当我将结果导出为ex​​cel时,保修日期的格式为/且当前日期不是......

谁有任何线索?

1 个答案:

答案 0 :(得分:0)

使用date功能,试试这个(我不确定你在案例陈述中使用'Status'的原因)

case 
    when date('now') between  w.start_date and w.end_date then 'Active'       
    else 'Inactive'
end