I have trouble with selecting items from a particular date interval. I want to select items from an interval based only on days and month.
items_table
item_name | date_from
item1 30.6.2015
item2 31.7.2015
item3 5.8.2019
item4 14.8.2000
I need something like this:
select *
from items_table
where date_from
between '****-07-31' and '****-08-13';
**** can be everything - for example 2010, 2011, 2012....
I would like to get only:
item2
item3
You can use date parts with some arithmetic:
where month(date_from) * 100 + day(date_from) between 0731 and 0813
Or as strings:
where to_char(date_from, '%m-%d') between '0731' and '0813'