I'm using Postgres 9.4, and already seen others asking the same (simple) question, but theirs answers do not solved my problem and I can't see why. Suppose that I have these table A with common data and what type these data correspond, and consequently, a indicator (which I want to add that is in another table B):
gid, type, indicator 1 a '' 2 b '' 3 e '' 4 a '' 5 d ''
And this table B, which describes types and their respectives indicators
type, indicator a alfa b alfa c beta d beta e gama
I'm doing this query, but getting
indicator=alfa for every row.
UPDATE A SET indicator = B.indicator FROM B JOIN A aa ON B.type = aa.type
The result that I was looking for A is something like this:
gid, type, indicator 1 a alfa 2 b alfa 3 e gama 4 a alfa 5 d beta
Hope that was clear