Skip to content
Advertisement

Selecting by month in PostgreSQL

I want to select rows according to the month of a date or timestamp column like this:

But I only get error messages in PostgreSQL.
How can this be done?

Advertisement

Answer

You can use EXTRACT function, like this:

Your problem comes from the fact that there is no such thing as Month function in PostgreSQL. Check online documentation here to see what you can get instead. Extract should be enough.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement