Postgresql between dates

44 Views Asked by At

i am learning SQL at the moment and i was wondering if somebody could help me. I´m working with postgresql and my task ist to write a query which shows all the, in this case, employees having their 25th anniversary, lets say tomorrow or in a week.

Using an interval function shows everyone between my two dates. How do i write a query giving information about employees having their 25th anniversary according to the "current_date"?

Would be nice if someone could help me!!

1

There are 1 best solutions below

0
Gordon Linoff On BEST ANSWER

The idea would be that they started 25 years ago, with a week of leeway, so you can filter like this:

where start_date >= curdate() - interval '25 year' and
      start_date < curdate() + interval '1 week' - interval 25 year'