How to query for a specific day of the month in Oracle

后端 未结 3 1579
轻奢々
轻奢々 2021-01-26 19:19

Trying to automate a query that will pull data for the current month where the day of the month (in the date field) is >= the 15th. Is this possible? If so, what is the syntax t

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-26 19:30

    If your date/time fields are of type timestamp you can do

    select x from 
    where EXTRACT(DAY from ) >=15
    and EXTRACT(MONTH from ) = EXTRACT(MONTH FROM CURRENT_TIMESTAMP)
    and EXTRACT(YEAR from )  = EXTRACT(YEAR FROM CURRENT_TIMESTAMP);
    

提交回复
热议问题