How to do date arithmetic to return a date as in "select ... from ... where date_field >= [today's date] - 5"

I need to do a query against a Firebird database and haven't seen my exact example.  I want to, in a query, do, "select ... from... where date_field >= [today's date] - 5".    I saw "current_date" in another posting, but I had thought I had to use, "get_date()"  to retrieve the system date?  Appreciate any help.  Susan
Who is Participating?
Gary BenadeConnect With a Mentor Commented:
select * from orders where recdate >= current_date - 5

is perfectly valid and returns the current date on the server.

You can also use current_time and current_timestamp
Nick UpsonPrincipal Operations EngineerCommented:
are you working in dialect 1 or 3
      FROM orders
      WHERE  date_field >= ’TODAY’ - 5
Nick UpsonPrincipal Operations EngineerCommented:
kacor's solution will work in dialect 1, dialect 3 will require

select * from employee where finishdate < current_timestamp - 5
beechersAuthor Commented:
Thanks to all for your help!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.