Reputation: 507
Test 1
Date id
01-02-2011 1
01-08-2011 1
01-04-2012 1
01-02-2013 1
01-02-2015 1
01-05-2015 1
01-06-2015 1
I want a query that only checks for the year like
select Date, id from Test1 where Date like 2015;
So the output is:
Date id
01-02-2015 1
01-05-2015 1
01-06-2015 1
Upvotes: 0
Views: 33
Reputation: 13700
If the date column has index, the best way I can think of is
select *
from test1
where Date >= to_date('01-JAN-15','DD-MON-YY') and Date < to_date('01-JAN-16','DD-MON-YY')
Upvotes: 3