How to compare two DATE values based only on date part in Oracle?

后端 未结 5 2298
醉话见心
醉话见心 2021-02-19 18:53

I am trying to get counts for last 30 days with the following query -

SELECT date_occured, COUNT(*) FROM problem
WHERE date_occured >= (CURRENT_DATE - 30)
GRO         


        
5条回答
  •  广开言路
    2021-02-19 19:35

    I think you'll want to trunc in the select part too:

     SELECT TRUNC(date_occured) AS short_date_occured, COUNT(*)
     FROM problem 
     WHERE date_occured >= trunc(SYSDATE- 30) 
     GROUP BY short_date_occured;
    

提交回复
热议问题