Skip to navigation
Give back the oldest update date row form a mssql table
16.05.19
SELECT l.supplier_id ,CONVERT(VARCHAR,CONVERT(datetime,CAST(l.eta AS VARCHAR(8)),112),3) AS eta ,CONVERT(VARCHAR,l.updated , 3) AS updated ,e.updated_count FROM ( SELECT *, ROW_NUMBER() OVER (PARTITION BY supplier_id ORDER BY updated DESC) AS RN FROM SL_planning_module.dbo.supplier_orders_etas_log) AS l LEFT JOIN SL_planning_module.dbo.supplier_orders_etas AS e ON l.supplier_id = e.id WHERE e.updated_count > 1 AND l.updated >GETDATE() - 1 AND RN = 1 ORDER BY l.supplier_id
Reply
Anonymous
Information Epoch 1732638148
Robustness is the child of transparency and simplicity.
Home
Notebook
Contact us