2021年1月22日星期五

Group by latest value sql

Forecast date            date          Value  Object     Demand or supply  01-01-2016 00:30    12-10-2019 00:00    85    Ice-cream     Demand  04-07-2018 02:59    26-12-2019 00:00    83    Crisps        Supply  07-08-2018 03:25    29-02-2020 00:00    50    Juice         Demand  29-10-2018 03:25    09-05-2020 00:00    76    Juice         Supply  25-02-2019 03:25    07-08-2020 00:00    74    Juice         Demand  01-07-2019 03:25    11-10-2020 00:00    69    Crisps        Demand  17-10-2019 03:25    17-12-2020 00:00    77    Meal          Supply  06-01-2020 03:25    29-03-2021 00:00    87    Eggs          Demand  

I have a dataframe like the above where the forecast keeps coming in for a particular date as more data becomes available

I want to get the latest forecasted value foe a certain date for each object and group demand and supply separately.

Logic-  -Latest forecast date for each date value and object  - Group demand/supply and object with Date desc  
https://stackoverflow.com/questions/65854329/group-by-latest-value-sql January 23, 2021 at 07:58AM

没有评论:

发表评论