sqlite case when 语句注意
1、sqlite3也是支持case when拳婊招稹语句的,但是我写的select 住院号, case when strftime(泌驾台佐39;%w',出院日期)in (3,4,5,6)And julianday(出科日期)- julianday(出院日期) between 3 and 5 then julianday(出科日期)- julianday(出院日期)-2else julianday(出科日期)- julianday(出院日期) end as 天数 from 出科明细一直不起作用,不管怎么改,结果都是julianday(出科日期)- julianday(出院日期)在网上也找不到原因,后来测试出来when语句的值要加单引号才起作用,上面语句改为以下形式就可以了when strftime('%w',出院日期)in ('3','4','5','6')And julianday(出科日期)- julianday(出院日期) between 3 and 5 then julianday(出科日期)- julianday(出院日期)-2我也测试过用“>,<,="等运算符时也要加单引号,但between不能加,加上反而出错。
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:63
阅读量:95
阅读量:49
阅读量:38
阅读量:83