我可以在Where子句中使用Firebird DateAdd函数吗? [英] Can I use the Firebird DateAdd function in the Where clause?
本文介绍了我可以在Where子句中使用Firebird DateAdd函数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在firebird中,我可以在where子句中使用 DateAdd
函数吗?我有以下sql;
In firebird can I use the DateAdd
function in the where clause?
I have the following sql;
select
s.number,
s.warranty_start
from
serial_number s
where
s.warranty_start > dateadd(year, -3, 'now')
我遇到错误;
expression evaluation not supported
推荐答案
您的第三个参数无效.
select
s.number,
s.warranty_start
from
serial_number s
where
s.warranty_start > dateadd(year, -3, current_timestamp)
'now'
是一个字符串文字,只能与 date
关键字一起使用,例如日期现在"
.因此,您需要写 date
'now'`.代替 current_timestamp
.
'now'
is a string literal that can only be used together with the date
keyword, e.g. date 'now'
. So instead of current_timestamp
you would need to write date
'now'`.
与DBMS特定的函数相比,相对于DBMS特定的函数,我更喜欢使用标准的SQL函数(如 current_timestamp
).
I prefer using standard SQL functions like current_timestamp
over DBMS specific ones if both are equivalent.
这篇关于我可以在Where子句中使用Firebird DateAdd函数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文