1 year ago

#373815

test-img

Pat

I need a column which replace DATETIME to amount of hours that passed till then

SELECT barcode
    ,location
    ,updated
FROM (
    SELECT order_reference AS barcode
        ,mth.location AS location
        ,mth.last_update_ts AS updated
        ,row_number() OVER (
            PARTITION BY order_reference ORDER BY mth.last_update_ts DESC
            ) rw
    FROM sales_order_header soh
    INNER JOIN manufacturing_tracking_history mth ON soh.id = mth.sales_order_header_id
    ) t
WHERE t.rw = 1
    AND location NOT LIKE '%Dispatch%' limit 300;

I have managed to replace DATETIME with days till date but can't figure out how to make it hours not days or at least hours if the period of time is less then a day. Also I would need it to return only rows younger then 40 days.

sql

hiveql

0 Answers

Your Answer

Accepted video resources