Link to home
Start Free TrialLog in
Avatar of beechers
beechersFlag for United States of America

asked on

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
Avatar of Nick Upson
Nick Upson
Flag of United Kingdom of Great Britain and Northern Ireland image

are you working in dialect 1 or 3
SELECT *
      FROM orders
      WHERE  date_field >= ’TODAY’ - 5
kacor's solution will work in dialect 1, dialect 3 will require

select * from employee where finishdate < current_timestamp - 5
ASKER CERTIFIED SOLUTION
Avatar of Gary Benade
Gary Benade
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of beechers

ASKER

Thanks to all for your help!