sqlite3日期和间隔函数 [英] sqlite3 date and interval functions
本文介绍了sqlite3日期和间隔函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道sqlite3是否支持间隔功能。 PostgreSQL接受以下语句,但是sqlite3无法解析它;
I wonder whether sqlite3 supports interval function. The following statement is accepted by PostgreSQL, however sqlite3 failed to parse it;
select
...
from
orders
where
...
and o_orderdate < date '1995-03-01' + interval '3' month
错误:靠近第4行:靠近'1995-03-01':语法错误
Error: near line 4: near "'1995-03-01'": syntax error
然后,我对语句进行了一些修改,例如;
Then, I modified the statement a little bit such as;
and o_orderdate < date('1995-03-01') + interval '3' month
这次错误是;
错误:在第4行附近:在'3'附近:语法错误
This time the error was; Error: near line 4: near "'3'": syntax error
不幸的是,相同的技巧对间隔函数无效,即
Unfortunately, same trick did not work for the interval function i.e.
and o_orderdate < date('1995-03-01') + interval('3' month)
或
and o_orderdate < date('1995-03-01') + interval('3') month
甚至
and o_orderdate < date('1995-03-01') + interval(3 month)
仍然给了我语法错误。
也许sqlite3不支持间隔函数,或者我在使用它时缺少某些东西吗?
Maybe sqlite3 does not support interval function or am I missing something in its usage?
谢谢lot
推荐答案
and o_orderdate < date('1995-03-01', '+3 month')
这篇关于sqlite3日期和间隔函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文