Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.
- MERGE tbl AS target
- USING tb2 AS source
- ON (target.id = source.id)
- WHEN MATCHED and source.price >450
- then
- UPDATE SET TARGET.price = SOURCE.price,
- TARGET.group = SOURCE.group
- 2.
- update tb1
- set
- tb1.price=tb2.price,
- tb1.group=tb2.group from tb2
- left join tb1 on tb1.id =tb2.id
- where tb1.id =tb2.id
- and tb1.price>450
Add Comment
Please, Sign In to add comment