I have a table like this:
postcode | value | uns
AA       | 10    | 51
AB       | 20    | 78
AA       | 20    | 78
AB       | 50    | 51
and I want to get a result like:
AA | 0.5 
AB | 2.5
where the new values are the division for the same postcode between the value with uns = 51 and the value with uns = 78.
How can I do that with Postgres? I already checked window functions and partitions but I am not sure how to do it.
 
     
     
    