↧
Answer by Colin 't Hart for Postgresql get rows based on minimum value
A simple aggregation likeselect warehouse_id, min(days)from this_tablewhere destination_id = 1group by warehouse_id;gives the answer in the question.
View ArticleAnswer by Sahap Asci for 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 clauseselect distinct on (warehouse_id) warehouse_id, days from this_table where...
View ArticlePostgresql get rows based on minimum value
Having this table:warehouse_iddestination_iddays112113213214315325122223I'd like to get the warehouse_id and daysfor each value of warehouse_id, where the row has the minimum value of days, and...
View Article