问题
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')
I get error;
expression evaluation not supported
回答1:
Your third parameter is invalid.
select
s.number,
s.warranty_start
from
serial_number s
where
s.warranty_start > dateadd(year, -3, 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'`.
I prefer using standard SQL functions like current_timestamp
over DBMS specific ones if both are equivalent.
来源:https://stackoverflow.com/questions/26338233/can-i-use-the-firebird-dateadd-function-in-the-where-clause