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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With