![]() ![]() You could use EXTRACT function and wrap it up with MAKE_INTERVAL and some math. (select value from demo.data where id=q.id and key='timestampstart')::timestamp - (select value from demo.data where id=q.id and key='timestampend')::timestampįrom (select distinct id from demo.data) qĮrror is the same: ERROR: syntax error at or near "::" (select value from demo.data where id=q.id and key = 'timestampend')::timestamp as TStart,Įxtract(days from duration1)::int * 24 + extract(hours from duration1)::int, - calculated hours (days * 24 + hours)Įxtract(mins from duration1)::int, - minutesįloor(extract(secs from duration1))::int - seconds, without miliseconds, thus FLOOR() (select value from demo.data where id=q.id and key = 'timestampstart')::timestamp as TEnd, I'm testing this query: select id as ticketid, The problem is that the first timestamp is and the second is so we have 1 day and some hours of difference. ![]() Look at this example, if you want easier: select timestamp_end::timestamp - timestamp_start as duration (select value from demo.data where id=q.id and key='timestampstart')::timestamp) as durata ![]() Just follow the thread) (select value from demo.data where id=q.id and key='timestampend')::timestamp Here the code: (isn't necessary you understand tables below. I'm creating a select that calculate the difference between two timestamps ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |