user2343361
user2343361

Reputation: 33

How to get all rows in certain month

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

Answers (2)

wootscootinboogie
wootscootinboogie

Reputation: 8695

select yourColumns
from yourTable
where datepart(month,yourDateColumn)=4 

TSQL solution..don't know which dialect you're using.

Upvotes: 0

Green Demon
Green Demon

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

Related Questions