开发者

Oracle - derive minutes from a Timestamp value

开发者 https://www.devze.com 2023-02-26 02:59 出处:网络
I have a 开发者_如何学Ctable with a Timestamp(6) column called START_DATE.Given this query: SELECT SYSDATE -MIN(START_DATE) FROM MYTABLE

I have a 开发者_如何学Ctable with a Timestamp(6) column called START_DATE. Given this query:

SELECT SYSDATE - MIN(START_DATE) FROM MYTABLE

might return:

0 1:12:32.2819281

I want that returned value in minutes, rounded to nearest minute, no decimal place, e.g.:

73

I know how to do this with queries that don't aggregate, by CAST'ing the START_DATE to a DATE, and then using ROUND, but as soon as I put in the MIN aggregation, that method doesn't work.

Thanks!


Check out the stored procedure on this page: Oracle Timestamp Math

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号