Created
May 24, 2019 09:13
-
-
Save RaidoS/c0e0171ed8fabae6c7cb50717942d266 to your computer and use it in GitHub Desktop.
Postgresql script example UPDATE table with INNER JOIN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH a AS ( | |
SELECT sportsmen_id FROM chalenge_results r | |
INNER JOIN | |
chalenge_chalengesporter s | |
ON r.sportsmen_id = s.id | |
WHERE date_part('year', s.date_req) = 2017 | |
) | |
UPDATE chalenge_results as c | |
SET chalenge_id = 2 | |
FROM a WHERE c.sportsmen_id = a.sportsmen_id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment