postgresql update column from select

Viewed 22963

I am attempting to update a column from one table with a select query.

It runs and updates the entire type_ column as religious (text field).

I am trying to only update the rows where the religious geometry intersects the parcel geometry.

update wash_parcels_final
set    type_ = t.religious 
from   (select wash_worship.religious 
        from   wash_parcels_final 
        join   wash_worship 
        on     st_intersects(wash_worship.geom, wash_parcels_final.geom)) t
2 Answers

I Use PgAdmin4 and last version of PostgreSQL and this query works for me:

update public."UserPoints"
set "AvailablePoints" = up."AvailablePoints" + tc."CLV"
from public."UserPoints" up join public."TEMPCLV" tc on up."UserId" = tc."CUSTOMER_NUMBER"

Hope help someone else!

Related