Created
November 5, 2015 13:25
-
-
Save danielbaccin/2dd756dd2f435759fe7f to your computer and use it in GitHub Desktop.
updating table rows in postgres using subquery
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
UPDATE produto | |
SET stf_codigo = subquery.situacao | |
FROM (select p.procod as produto, s.stf_codigo as situacao from produto p | |
inner join situacao_fiscal s on (p.trbid = s.trbid)) AS subquery | |
WHERE produto.procod = subquery.produto; | |
http://stackoverflow.com/questions/6256610/updating-table-rows-in-postgres-using-subquery |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment