How to find median in sql

前端 未结 4 1352
遇见更好的自我
遇见更好的自我 2021-01-24 00:08

I have the following sql query which gives me the total h_time grouped by month, week and day. Instead I want the median h_time for month, week and day. How do I do that in Orac

4条回答
  •  醉话见心
    2021-01-24 00:37

    Your problem probably come from the time part that the DATE type carry (even if you don't explicitly set it).

    To get rid of it you can use the trunc function.

    Replace:

    SELECT DAY,
    

    By:

    SELECT trunc(DAY)
    

    And:

    GROUP BY DAY
    

    By:

    GROUP BY trunc(DAY)
    

提交回复
热议问题