Reputation: 33
I have a column named DC34_DATE
of type DATE
(defined this way: DATE '2013-04-17'
). I need to select all rows for a specific month (for example April). I have used WHERE MONTH(DC34_DATE)=04;
but it doesn't work.
Upvotes: 2
Views: 4623
Reputation: 8695
select yourColumns
from yourTable
where datepart(month,yourDateColumn)=4
TSQL solution..don't know which dialect you're using.
Upvotes: 0
Reputation: 4208
You can use the extract from date function to get the date. Try this.
WHERE EXTRACT(month from DC34_DATE) = '4';
Upvotes: 2