11

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
3
  • What is t.religious in that query? Without that part, it might work, though type_ seems like a strange choice for a column name. Commented Jun 3, 2017 at 16:05
  • t.religious is a text Commented Jun 3, 2017 at 16:08
  • so add where geometry_intersects to the end?.. Commented Jun 3, 2017 at 16:18

2 Answers 2

13

I think this is what you want:

update wash_parcels_final
    set type_ = ww.religious 
    from wash_worship ww  
    where st_intersects(ww.geom, wash_parcels_final.geom);
Sign up to request clarification or add additional context in comments.

Comments

0

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.