Skip to content

Instantly share code, notes, and snippets.

@RRRoger
Last active May 8, 2021 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RRRoger/fcb501118ac010d47673c9219b4feca0 to your computer and use it in GitHub Desktop.
Save RRRoger/fcb501118ac010d47673c9219b4feca0 to your computer and use it in GitHub Desktop.
-- it doesn't work, don't use it
UPDATE
Table_A
SET
Table_A.col1 = Table_B.col1,
Table_A.col2 = Table_B.col2
FROM
Some_Table AS Table_A
INNER JOIN Other_Table AS Table_B
ON Table_A.id = Table_B.id
WHERE
Table_A.col3 = 'cool'
@RRRoger
Copy link
Author

RRRoger commented Oct 28, 2020

UPDATE 
    mrp_bom_by_product_line
SET workcenter_id = slave.workcenter_id
FROM 
    mrp_bom_by_product_line AS master
LEFT JOIN mrp_bom AS slave ON slave.id = master.bom_id
WHERE True
  AND master.workcenter_id IS NULL
  AND slave.workcenter_id > 0;

@RRRoger
Copy link
Author

RRRoger commented Oct 28, 2020

this SQL statement doesn't work,

i have run it on production enviroment and all data were covered with the same value!! 👎👎👎👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment