I have a field of type datetime
and I need to do a query based only on the month and year. When searching, I noticed that there is a extract
function, but it separates only one value from datetime
.
example:
SELECT * FROM mytable
WHERE EXTRACT(month from date_column) = 5
AND EXTRACT(year from date_column) = 2018;
Is there a function that does this "extract" at one time rather than using AND
?