I have a table:
id name location
1 aaa home
1 aaa village
1 aaa office
2 bbb village
2 bbb office
3 ccc home
3 ccc office
When I write a query, I should get single record for each having precedence home > office > village
Output:
1 aaa home
2 bbb office
3 ccc home