I have a table with fields:
id
category_id
property_id
Weight
How can I get list with {category_id, property_id} where property_id from the highest weight?
Example:
id | category_id | property_id | weight |
1 | 1 | 1 | 20 |
2 | 1 | 2 | 10 |
3 | 2 | 2 | 30 |
4 | 2 | 3 | 40 |
Right results after query:
category_id | property_id
1 | 1 (because 20 > 10)
2 | 3 (because 40 > 30)
It is simple issue, but I am searching easiest and right way, how I can do it with postgresql instruments without subqueries and temporary tables.