sql - postgres query to return some of column value -


i've following query return run time 1200 videos , want total of run time in hh:mm:ss:ms

select  runtime video ready_date between '2017-07-01' , '2017-07-30'; 

my output like

"00:00:33:07"  "00:00:37:09"  "00:01:52:02"  "00:00:41:05" 

i've tried sum(runtime) looks i'm doing wrong thing here ,

any tips ?

one way - cast timestamp time interval, sum ok, eg:

vao=# video(runtime) (values('00:00:33:07'),('00:00:37:09'),('00:01:52:02')) select sum(to_timestamp(runtime,'hh24:mi:ss:ms')::time::interval) video;      sum -------------  00:03:02.18 (1 row) 

update: in case smth like:

select sum(to_timestamp(runtime::text,'hh24:mi:ss:ms')::time::interval)  video  ready_date between '2017-07-01' , '2017-07-30'; 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -