Help in writing a POSTGRESQL

Help in writing a POSTGRESQL


Bucket 1- Value of inventory in 1st aging bucket as defined in aged inventory parameters. Typically 0-3 months. Decimal (14.2)

The bucket is defined as “Date of last demand”. So you will have to build a query that sum’s current on-hand inventory values based on the date of the last sale. you can get that by using select item_id, Max(date_of_dmd ) from d_demand_transaction group by item_id. So bucket 1 is sum of inventory value where max date is < today – 90 days)