Selecting by month in PostgreSQL

前端 未结 1 857
野性不改
野性不改 2020-12-16 08:58

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

SELECT id, name, birthday 
FROM employee.pers         


        
相关标签:
1条回答
  • 2020-12-16 10:01

    You can use EXTRACT function, like this:

    SELECT id, name, birthday FROM employee.person 
    WHERE EXTRACT(MONTH FROM birthday) > 10;
    

    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.

    0 讨论(0)
提交回复
热议问题