Convert my entire list which is in days , hours-min-sec FORMAT TO only hours which is a whole number because I need to calculate the median of the new list.
For each product id the number of hours is calculated. I have only pasted a bit of my list. but the list is very huge so I cannot hard code the dates and find the hours it takes. Instead want to convert my whole list to hours since I need to calculate median of the new list. Median only takes one format in numbers.
SELECT
"FulfillmentHistories"."fulfillmentId",
(max("createdAt")-min("createdAt")) as "Range"
FROM
"FulfillmentHistories" //takes the time difference between two dates
where
"currentState" IN ('created','delivered')
GROUP BY
"FulfillmentHistories"."fulfillmentId"
HAVING COUNT("FulfillmentHistories"."createdAt")>1
ORDER BY "Range" DESC
This gives me difference in time between two datestamps so the result of this gives a list in day, hour-min-sec format. as shown Need a one format list in postgresql. Please help, thankss!
Range
7 days, 4:30:56.324000
2 days, 18:26:25.955000
2 days, 16:38:25.600000
2 days, 15:01:34.488000
2 days, 11:37:27.956000
2 days, 8:15:20.769000
2 days, 6:59:28.396000
2 days, 5:13:47.411000