-
-
Notifications
You must be signed in to change notification settings - Fork 415
How to do an Update Query on one to many relationship tables. #1888
Unanswered
jaiswal-rishabh
asked this question in
Q&A
-
How do I write a query like below, using go-pg. I am trying to update child table records based on where clause both on child table and parent table columns. Working Postgres raw query is
UPDATE child_table ct
set col_ct_A = 'foo'
FROM parent_table pt where pt.id = ct.reference_id
and pt.col_pt_X = 'some_value' AND ct.id IN ('foo','bar') Returning ct.*;
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment