Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have three tables
X [id,event_time] Y [x_id,z_id] -- here x_id is id from X and z_id is id from Z Z [id,event_time]
Now I want to update the values of X[event_time] with Z[event_time]. Is there any query that can be formed for doing this?
update x set x.event_time = t.event_time from ( select z.event_time ,y.x_id from z join y on z.id = y.z_id ) t where x.id = t.x_id
Add a comment
something like this
UPDATE X SET event_time = z.event_time FROM Z z JOIN Y y ON y.z_id = z.id JOIN X x ON y.x_id = x.id
UPDATE X SET event_id = (SELECT z.event_id FROM Z INNER JOIN Y WHERE Z.id=Y.z_id and Y.x_id=X.id)
Required, but never shown
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.
Explore related questions
See similar questions with these tags.