Postgresql get rows based on minimum value
Here is the query which orders by first for warehouse_id and days then gets first record only according to DISTINCT ON clause


select distinct on (warehouse_id) 
    warehouse_id,
    days 
  from this_table 
  where destination_id = 1 
  order by warehouse_id, days 


warehouse_id | days
-----------: | ---:
           1 |    2
           2 |    3
           3 |    5


db&lt;&gt;fiddle here